Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to access DBC stored procs in .Net
Message
 
 
To
21/12/2004 15:36:13
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
00971118
Message ID:
00971425
Views:
20
Ramil,
I use VFP 8 and VS.NET 2003. From the other message I can see that you already figured out what the problem was. Please, if there are
changes from VFP 8 to VFP 9 or VS.NET to a new version (as far as calling stored procedure) that effect my code, let me know.


>Thanks a lot Dmitry. I have a problem using VFP 9 database and .Net 2005 C# Beta. This is the error: Function is not implemented.
>
>What are the versions that you are using.
>
>>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
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform