Link to home
Start Free TrialLog in
Avatar of grouchyfd
grouchyfdFlag for United States of America

asked on

How do I call a stored procedure from my database to run in my form that already has a table adpater on it?

I have VS2005.
I have a form that was created through the datasource wizard, dropping the proper objects onto my form. The form is now  connected to my database through the table adapter, bindingsource, and bindingnavigator that it created. This all works fine. Is there a way to use this table adapter to call a stored procedure from my database? I can't seem to get it to work. I really don't want to have to code all the objects on the form if I don't have to, to save time. I'm hoping there is way to use the existing table adpater.
The code I'm trying to use is

dim Com as new SqlClient.SqlCommand
Com.CommandType =  CommandType.StoredProcedure
Com.CommandText = "StoredProcedure"

Thanks
ASKER CERTIFIED SOLUTION
Avatar of vb_jonas
vb_jonas
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of grouchyfd

ASKER

Excellent!!! I have this now working. The points are yours, vb jonas. This updates the table properly. Now I'm trying to get the textboxes on my form to show the changes when the procedure is fired. I can't seem to get it.

Dim Received as integer
Received = Textbox1.Text
Received = Com.ExecuteScalar
Textbox1.Text = Rec
Great! :-)

and you have filled your dataset again, TableAdapter1.fill(DataSet1)?
Thank you for helping me through a "Duh" type moment on the tableadapter.fill method.