Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a stored Procedure for Windows Application

Status
Not open for further replies.

ProgrammingB52

Technical User
May 7, 2003
37
US
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????
 
Set the commandtext property first, so that it knows to expect you to add the parameters afterwards.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top