Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 sql server and vb

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-02 : 07:12:12
Jyothi writes "I have a certain code in my visualbasic programming which reads as follows:
mydb.execute "myproc,1,2"
when i execute this line from vb..it is not running and i cannot get the result.
but if i copy the same thing and paste it in sql query analyser then it runs perfectly...is there any possible explanation for this. this is repeated every time i run it. Please help me to find a solution. i use sql server 2000 and vb 6.0 and mydb is a adoconnection."

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-06-02 : 09:10:57
Search here for "passing parameters into SP's".....or variations on that phrase....
you'll see some examples that should help you.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-06-02 : 09:23:39
show us more of your code -- how are you returning/using the results?

- Jeff
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2004-06-02 : 09:56:33
How exactly can you not get the result? Have you tried appropriate use of SET NOCOUNT ON if it is a multi-step procedure?

-------
Moo. :)
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-06-06 : 01:57:08


Function foo()
'assume connection
Dim objCmd as ADODB.Command

Call EstablishConnection() 'function to connect
set objCmd = new ADODB.Command

With objCmd
.ActiveConnection = objConn
.CommandText = "select_template_components_by_template" 'our stored
procedure
.CommandType = adCmdStoredProc 'its a stored
procedure
.Parameters.Append .CreateParameter("ID", adBigInt, adParamInput, , Me.txtID.Text)
Set objRSFill = .Execute
Set objRSFill.ActiveConnection = Nothing
Call ReleaseConnection 'close that connection up
End With

'do other code..maybe a while loop ?
Set objCmd = Nothing
Set objRSFill = Nothing

End Function


You'll need some error handling, and your own variables to pass to the SPROC.




Jon
www.web-impulse.com
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-06 : 20:42:07
http://www.nigelrivett.net/VB6DataAccessLayer.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -