Thanks - I am able to call stored procedures. What I would like to know is
how I can get a return value from a stored procedure that tells me whether
or not the procedure worked. For example in the attached code I am simply
passing parameters to the stored procedure and would like to return a result
code (text or integer) that tells me if its successful or not. In the
example the "email" filed is unique so attempts to add a second record with
the same e-mail as another will fail. (presently the program just crashes).
I have tried everything to get a return value including defining parameters
ParamaterDirection.Output & ParameterDirection.ReturnValue
Nothing has ever worked - the records are added yet I can't get my response
I'm sure that there is a simple solution yet I can't find it in any examples
so if you could tell me what would need to be done to return a value at the
end of this code I would greatly appreciate it!
ALTER PROCEDURE dbo.MembersAddNew
INSERT INTO members
return <---- SOMETHING??????
> For starters, try calling any Stored Procedure (say XYZ),
> by using 'exec XYZ'. If the SP has parameters, then of
> couse you have to handle those -- but start by calling SPs
> without params. Like sp_rename.
> >-----Original Message-----
> >I'm going through the process of learning VB.NET and SQL
> Server 2000.
> >Naturally I have books on both however I don't have one
> that discusses both
> >topics together.
> >What I would really like is a VERY basic tutorial on
> calling SQL stored
> >procedures and returning values from them and handling
> errors. I have
> >searched MSDN and five VB.NET books and typically they
> start talking about
> >DataGrid and DataAdapter which is well and good and does
> work very well.
> >However: I'm looking for a way to just add a record to a
> file (nonquery)
> >and return a result to the calling program.
> >I have a simple web project that gets name and address
> info and does update
> >an SQL database however I can't figure out how to
> determine if the record
> >was added successfully (unique key) or not and return
> this to the calling
> >VB.NET program.
> >Any "pointers" to sources would be greatly appreciated.