|
-
July 26th, 1999, 03:58 PM
#1
Stored Procedure
I want to call a SQL stored procedure from VB app. i have to pass parameters to
it. everytinhg worked fine. There is a message in the strored procedure if
the member was added like 'Member added'. when i execute this direclty i
saw this message. But how can i see this message without writing any code in
my application?
Thanks in advance,
Hima
-
July 27th, 1999, 02:25 AM
#2
Re: Stored Procedure
given this SP
create proc lahtestpr
as
print "hello,world"
you can call it like this (without parameter)
de.lahtestpr
to get the contents of the print statement, inspect
de.Connection1.Errors(0).Description
it contains "hello,world".
an error is not raised.
-
August 1st, 1999, 05:05 PM
#3
Re: Stored Procedure
Thanks for the response. What is 'de' in you example?.
-
August 2nd, 1999, 02:15 AM
#4
Re: Stored Procedure
the name of the dataenvironment object (by default: DataEnvironment1, but I am a lazy)
-
August 3rd, 1999, 11:45 AM
#5
Re: Stored Procedure
Lothar,
I got an error when i execute line
de.connection1.errors(0).description
error is "invalid use of property"
my connection object is connection1,data environment designer is de.
also is it possible to get the print messages in the stored procedure using command object (without using data environment designer)?
Hima
-
August 4th, 1999, 02:07 AM
#6
Re: Stored Procedure
you didn't post your code, but if you code really looks like this
de.connection1.errors(0).description
it doesn't work, because you are accessing a property. Use it as a RHS as in
msgbox de.....
or store it in a variable.
It doesn't matter whether you use a data environment or not.
The errors collection can be accessed from any connection object.
-
August 4th, 1999, 09:46 AM
#7
Re: Stored Procedure
Lothar,
I did not write any code. In a new project I added data environment designer. For a connection object I specified everything. Then added a command object and for database object (general tab) I specified stored procedure and for object name “my stored procedure name” (addadult). And in the parameter tab I supplied values for all my parameters. When it prompt me to execute or not, I click yes.
I added a command button I just put code like this
Msgbox dataenvironment1.connection1.errors(0).description
Now I got the message
Error# 3265
“ADO could not find the object in the collection corresponding to the name or ordinal reference requested by the application”
do I have to write any code?
Thank you very much for your time.
Hima.
-
August 4th, 1999, 09:49 AM
#8
Re: Stored Procedure
>do I have to write any code?
Unfortunately, yes :-)
That's the bad thing about programming :-)
you need to execute your SP as in
dataenvironment1.addadult
this should execute your SP. If it takes any parameters, pass its values.
then write
msgbox ...description
-
August 4th, 1999, 10:42 AM
#9
Re: Stored Procedure
It worked. But not the way I was looking for. When I tried with dataenvironment1.addadult , it did not work. I got error “member not found” . so I tried with the code below.
DataEnvironment1.Command1 "Joe", "D", "Bernal", "Lake st", "Madison st", "Chicago", "66666", “(206)000000"
MsgBox DataEnvironment1.Connection1.Errors(0).Number
I got the message
[Microsoft][ODBC SQL server driver][SQL server]
And the row is added. But I want the message ‘Member Added’, which is in my stored procedure. Is it possible?
Thanks,
Hima
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|