Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to access DBC stored procs in .Net
Message
From
21/12/2004 16:47:57
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
00971118
Message ID:
00971179
Views:
18
Hi Dmitry,

I got it to work now. Thank you.

>>Hi all,
>>
>>How do I access my VFP database stored procedures from .Net? C# preferred.
>>
>>Thanks.
>
>
>Here is a sample code that I use to call VFP Stored Procedure:
>
>
>string connectionString = "PROVIDER=VFPOLEDB.1;" + "DATA SOURCE=" + strDataLocation + ";UID='';PWD=''";
>string commandText = "My_StoredProc";
>
>OleDbCommand oCommand = new OleDbCommand();
>OleDbConnection OleDbConn2Vfp = new OleDbConnection(connectionString);
>OleDbConn2Vfp.Open();
>oCommand.Connection = OleDbConn2Vfp;
>oCommand.CommandText = commandText;
>oCommand.CommandType = CommandType.StoredProcedure;
>
>// Pass parameters to SP
>oCommand.Parameters.Add( "@Param1Name", strParam1Value );
>oCommand.Parameters.Add( "@Param2Name", strParam2Value );
>oCommand.Parameters.Add( "@Param3Name", strParam3Value );
>
>try
>{
>strReturnXml = (string) oCommand.ExecuteScalar();
>}
>catch
>{
>strErrorMessage = "Failed to execute Stored Procedure";
>}
>finally
>{
>OleDbConn2Vfp.Close();
>}
>
>
>Please let me know if you have any questions about my code.
>
>HTH
ramil
~~ learning to stand still
Previous
Reply
Map
View

Click here to load this message in the networking platform