Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to access DBC stored procs in .Net
Message
De
22/12/2004 17:06:07
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
00971118
Message ID:
00971626
Vues:
19
There is one. In .Net 2005 C# Beta the Command.Parameters.Add(spname,value) will generate a compile warning. You will be advised to use the .AddWithValue(spname, value) method instead.

>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
ramil
~~ learning to stand still
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform