Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling VFP Stored Proc
Message
From
30/06/2005 18:48:21
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Novell 5.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01027785
Message ID:
01027948
Views:
40
>I have a VFP stored procedure that I'm trying to use in an ASP.NET login screen. It works in VFP - if I do spLogin("mjones","pass") it will return an integer PK (or -1 if it's not valid).
>
>I'm getting an error on the ExecuteScalar command like "Variable 'Q28P2' is not found.". If I run it again it's the same message except with 'Q29P2', then 'Q30P2', etc.
>
>If I comment out the two RetVal lines I get a different error: "Function argument value, type or count is invalid."
>
>Any suggestions appreciated.
>
>=================================================
>public sub Submit(Sender as Object, e as EventArgs)
> dim intID as Integer = 0
> Dim MyConnection As New OleDbConnection("Provider=VFPOLEDB.1;" + _
> "Data Source=D:\Data\TR.dbc")
>
> dim lcLogin,lcPassword as string
> lcLogin = Login.text
> lcPassword = Pass.text
>
> dim loCommand as OleDbCommand = New OleDbCommand("spLogin",MyConnection)
> loCommand.CommandType = CommandType.StoredProcedure
>
> dim Param1 as OleDbParameter = loCommand.Parameters.Add("@Param1",OleDbType.Char)
> Param1.Direction = ParameterDirection.Input
> Param1.Value = lcLogin
>
> dim Param2 as OleDbParameter = loCommand.Parameters.Add("@Param2",OleDbType.Char)
> Param2.Direction = ParameterDirection.Input
> Param2.Value = lcPassword
>
> dim RetVal as OleDbParameter = loCommand.Parameters.Add("@RetVal",OleDbType.Integer)
> RetVal.Direction = ParameterDirection.ReturnValue
>
> MyConnection.Open()
>
> intID = loCommand.ExecuteScalar
>
> MyConnection.Close()
>
>end sub

-Remove retval. ExecuteScalar returns the return value(return value is an object and needs a cast in C#. I don't know VB but probably you'd need CType()).
-Remove @ from parameter names. VFP doesn't use named parameters as MSSQL. Use positional parameters
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform