Reputation: 105
I have here a problem on how to add one value in all columns of a database.
Here's what it looks like
I use SQL query to add the other values and here's the code
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
LeaveDatabaseDataSetTableAdapters.EmployeesTableAdapter employees = new LeaveDatabaseDataSetTableAdapters.EmployeesTableAdapter();
employees.InsertEmployee(this.txtID.Text.Trim(),
this.txtName.Text.Trim(),
this.txtLeaveCredits.Text.Trim());
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'leaveDatabaseDataSet.Employees' table. You can move, or remove it, as needed.
this.employeesTableAdapter.Fill(this.leaveDatabaseDataSet.Employees);
}
I haven't put some codes on the "Add Monthly Leave Credits" button because i don't have any idea on how to do this assignment.
Upvotes: 0
Views: 170
Reputation: 34244
I am not sure about how you use SQL because you don't show it in your pasted code.
You need to implement LeaveDatabaseDataSetTableAdapters.EmployeesTableAdapter.AddMontlyLeaveCredits() method using the following SQL statement.
UPDATE Employees SET LeaveCredits = LeaveCredits + @mc
And add @mc as a parameter from your TextBox.
Upvotes: 1