ProgrammingB52
Technical User
In my C# application I have an update method that is not updating the database.
private void btnUpdate_Click(object sender, System.EventArgs e){ oleDbDataAdapter1.UpdateCommand.Parameters.Add("@Phone", contactsPhone);
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@CustomerID", listBox1.SelectedValue);
oleDbDataAdapter1.UpdateCommand.CommandText = "UPDATE Customers SET Phone = @Phone WHERE CustomerID = @CustomerID";
oleDbDataAdapter1.Update(dataSet11);
This still doesn't work. Do I have to create a stored procedure in SQL server to recognize @contactPhone and @CustomerID to mean the table fields Phone and CustomerID.I am not sure how to do this something like:
create procedure insertCustomerPhone
insert into Customer
declare @contactPhone =Phone
declare @CustomerID=CustomerID
GO;
How do I create this stored Procedure????
private void btnUpdate_Click(object sender, System.EventArgs e){ oleDbDataAdapter1.UpdateCommand.Parameters.Add("@Phone", contactsPhone);
oleDbDataAdapter1.UpdateCommand.Parameters.Add("@CustomerID", listBox1.SelectedValue);
oleDbDataAdapter1.UpdateCommand.CommandText = "UPDATE Customers SET Phone = @Phone WHERE CustomerID = @CustomerID";
oleDbDataAdapter1.Update(dataSet11);
This still doesn't work. Do I have to create a stored procedure in SQL server to recognize @contactPhone and @CustomerID to mean the table fields Phone and CustomerID.I am not sure how to do this something like:
create procedure insertCustomerPhone
insert into Customer
declare @contactPhone =Phone
declare @CustomerID=CustomerID
GO;
How do I create this stored Procedure????