Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executing SP using VB and VFP7.0

Status
Not open for further replies.

2969

IS-IT--Management
Oct 18, 2001
107
US
how can i return a recordset using SP and VB. I am usig this

i am using a simple select statement'select fieldname from tablename' in a SP in vfp7.0. iam executing this sp thru vb6.0 using
SQL_QTL = "GetSQL()"
Set objCmd = New ADODB.Command
With objCmd
.CommandText = SQL_QTL
.CommandType = adCmdText
.ActiveConnection = cnnadoconn
End With
Set objRs = objCmd.Execute()

it returns .T and .F as values in the fieldss. Can anyone let me know why does it do instead of having actual DB values in the recordset!fieldname

thx
TA
 
try to change the line:

.CommandType = adCmdText

to:

.CommandType = adCmdStoredProc
 
it gives an error of unrecognized word...
 
The code below is taken from SQL Server Books Online, it shows how to get value from store procedure

-----------------------------------------
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset

cn.Provider = "sqloledb"
cn.Properties("Data Source").Value = "MyServerName"
cn.Properties("Initial Catalog").Value = "pubs"
cn.Properties("Integrated Security").Value = "SSPI"
cn.Open

Cmd.ActiveConnection = cn
Cmd.CommandText = "sp_who"
Cmd.CommandType = adCmdStoredProc

Set rs = Cmd.Execute
Debug.Print rs(0)
rs.Close
-------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top