Beginner question on using sprocs

  • Thread starter Thread starter Angelina
  • Start date Start date
A

Angelina

Hi,

I have got a table in my access.adp (MSDE) database as
shown below:

Meal table:
Meal_name
Meal_cost

i have created a SPROC in access.adp to insert values
into this table based on what the user enters at the
interface:

INSERT INTO dbo.Available_Meals
SELECT Meal_desc, Cost
FROM dbo.Available_Meals
WHERE (Meal_desc = @Meal_desc) AND (Cost = @Cost)

what i need help on is what code (or actions on the IDE)
to write in vb.net so i can call this sproc and pass
these parameters to it from the 2 textboxes i have.
Can someone help me? I am a complete beginner?
 
Ah, I'm not sure what you're trying to do here. The INSERT query you have is
pretty strange.
So, you have a table (Available_Meals) and you want to add a row to it. The
INSERT in the SP should look like this:

INSERT INTO dbo.Available_Meals (Meal_Desc, Cost) VALUES (@Meal_Desc,
@Cost)

Writing the ADO.NET code to take the captured parameters and pass them to
the SP is detailed in my article on stored procedures. See
(www.betav.com\articles.htm) and in my book on ADO.NET.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Hi,

I thought the insert code was abit funny!!! it was
generated by access.adp Stored procdure generator!

All i want to do is insert the 2 values into a database.
Now that i have created the SPROC i wanted to know how to
call it from vb.net?
Where abouts do i write this code....i.e. the onclick
event of a button?

In all the books it uses code and does not use the
dataadapter wizard that generates the connection for you.
If i have used this do i still need to use coding to call
the sproc or can i do it all through the GUI?

I tried to have a look through your site but i could not
locate the article........what is it called?

I have purchased a book called Proffesional ADO.Net with
vb.net, but im still waiting for it to arrive :o)

thx
 
Back
Top