Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access stored procedure
Message
From
03/01/1999 21:45:57
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00172117
Message ID:
00172310
Views:
30
>>>Bui Chi,
>>>
>>>The issue is not the ODBC driver but what code is in the stored procedure. What is the code that causes the error (from the stored procedure in VFP)?
>>
>>Jim,
>>
>>I used a simple function as follow:
>>
>>function plus(a,b)
>> return a+b
>
>Bui Chi,
>
>That code should not cause the error, but other code will. There is a help file with the VFP ODBC driver that lists all of teh commands that are NOT supported through ODBC.
>
>Is this ode being called by one of the rules on a field or table, or are you trying to execute it with SQLExec()? I don't kow that the VFP stored procedures are available to be called with SQLExec, but hey do work when they are called from a database rule and they don't contain any of the disallowed commands.
*************************************
Thank Jim Booth !

I do not use SQLExec function, I use ADO or DAO as following (Visual Basic 6.0):
=======================================
' Use ADO
Dim cn as new ADODB.Connection
Dim cmd as new ADODB.Command
Dim pr as ADODB.Parameter

Private Sub CmdGoADO_Click()
cn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=DS_FOX_ODBC"
cn.Open ' Open connection
' Create return parameter
Set pr = New ADODB.Parameter
pr.Type = adNumeric
pr.Direction = adParamReturnValue
cmd.Parameters.Append pr
'First input parameter
Set pr = New ADODB.Parameter
pr.Direction = adParamInput
pr.Type = adNumeric
pr.Value = 10
cmd.Parameters.Append pr
'Second input parameter
Set pr = New ADODB.Parameter
pr.Direction = adParamInput
pr.Type = adNumeric
pr.Value = 40
cmd.Parameters.Append pr

cmd.Parameters.Refresh
Set cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cn.CursorLocation = adUseClient
cmd.CommandText = "Plus"
' Execute stored procedure
cmd.Execute ' Cause error
End Sub
==========================================
When the above code execute to cmd.Excute, Visual Basic raises an exception with the description:
[Microsoft][ODBC Visual FoxPro Driver]Driver not capable
It works well if I connect to ODBC for SQL Server 6.5!
==========================================
' Use DAO
Private Sub cmdGoDAO_Click()
Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim cn As DAO.Connection
Dim qd As DAO.QueryDef
DBEngine.DefaultType = dbUseODBC
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("DB1", dbDriverCompleteRequired, False, "ODBC;dsn=DS_FOX_ODBC")
Set cn = db.Connection
Set qd = cn.CreateQueryDef("qd1", "{?=call plus(?,?)}")
qd.Parameters(0).Direction = dbParamReturnValue ' Cause error
qd.Parameters(1).Direction = dbParamInput
qd.Parameters(2).Direction = dbParamInput
qd.Parameters(1).Value = 10
qd.Parameters(2).Value = 40
qd.Execute
End Sub
==========================================
When the above code execute to qd.Parameters(0).Direction = dbParamReturnValue, Visual Basic
raises an exception with the description:
run-time error '3146' :ODBC--call failed
It works well if I connect to ODBC for SQL Server 6.5!
==========================================
In the code above, I use the following tools:
Visual Basic 6.0
ODBC version 3.510.3002.13
ADO 2.0
DAO 3.51
Microsoft Visual FoxPro ODBC Drivers (version 6.00.816700)
Microsoft OLEDB Provider for ODBC Drivers (MSDAC 2.0)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform