|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Executing SQL Server stored procedure from vb6
Hi all,
Can anyone help me provide the code as to how to Execute a SQL Server stored procedure with a parameter from vb6. Thanks |
|
#2
|
|||
|
|||
|
__________________
Phil Weber http://www.philweber.com Please post questions to the forums, where others may benefit. I do not offer free assistance by e-mail. Thank you! |
|
#3
|
|||
|
|||
|
Executing SQL Server stored procedure from vb6
Hi Weber,
Thanks for your reply. Actually I need to pass a parameter to the stored procedure. For example, in sql server the stored procedure is executed as exec test '200410' . I have been trying this code Private Sub Form_Load() Dim con As New ADODB.Connection Dim stmt, parm As String Dim rs As New ADODB.Recordset con.ConnectionTimeout = 100 con.Open "northwind", "userid", "password" parm = "200410" stmt = " test '" & parm & "'" rs.Open stmt, con, adOpenStatic, adLockReadOnly, adCmdStoredProc If rs.STATE = adStateOpen Then rs.Close If con.STATE = adStateOpen Then con.Close Set rs = Nothing Set con = Nothing End Sub It throws an error [Microsoft][ODBC Sql Server Driver] Syntax error or access violation. Please help as to where the statement is failing. Thnks & Rgds, Mallik |
|
#4
|
||||
|
||||
|
__________________
Paul ~~~~ Microsoft MVP (Visual Basic) |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|