ADODC w/SQL Server2000 S 
Author Message
 ADODC w/SQL Server2000 S

 I have an ADODC control on a form and it is connectiong to a Stored
 Procedure in SQL Server 2000.  My problem is I can't seem to figure out how
 to pass parameters to the SP using the adodc.  Any ideas?


Fri, 19 Dec 2003 23:34:59 GMT  
 ADODC w/SQL Server2000 S
Hi,

There are several ways to pass parameters to the Stored Procedure in ADO
Data control.

One
====

Set the Commandtype property of the ADODC control to adCmdStoredProc, and
specify the Store Procedure name and the parameters in the RecordSource
property of the control.

Example:

Private Sub Command1_Click()

Adodc1.ConnectionString = "provider=sqloledb;server=Your erver name
;database=northwind;user id=sa;"
Adodc1.CommandType = adCmdStoredProc
Adodc1.RecordSource = "mrs(4)"
'mrs is the name  of the stored procedure with the parameter, the number 4
is the value of the parameter passed to the stored procedure mrs.
Adodc1.Refresh

End Sub

Two
=====

Set the Commandtype property of the ADODC control to adCmdUnknown or
adCmdText, set the RecordSource property to the following:

1. [Stored Procedure name] parameter
2. Exec [Stored Procedure name] parameter

Example:

Private Sub Command1_Click()

Adodc1.ConnectionString = "provider=sqloledb;server=Your erver name
;database=northwind;user id=sa;"
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "mrs 4" ? or Adodc1.RecordSource = "exec mrs 4"
'mrs is the name  of the stored procedure with the parameter, the number 4
is the value of the parameter passed to the stored procedure mrs.
Adodc1.Refresh

End Sub



Sat, 20 Dec 2003 19:47:54 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. slow result set processing - delphi/ADO to SQL Server2000

2. INSTEAD OF INSERT Trigger - SQL Server2000

3. Time() returning hh:mm:ss tt and not HH:mm:ss

4. Executing T-SQL in SS 6.5

5. Using ADODC in a SQl statement

6. How can i use INDEX in ADODC - Como usar indices em ADODC

7. Using a SQL ADODC

8. Variables in a SQL query with ADOdc

9. Binding datarepeater to child recordset of adodc control with recordsource created whith sql SHAPE statement

10. One connection to SQL per ADODC used?

11. ADODC problem following SQL request

12. VB6 and SQL 6.5, ADODC And Textbox

 

 
Powered by phpBB® Forum Software