using System; using System.Data; using System.Data.OleDb; OleDbConnection oConn = new OleDbConnection(cConnString); try { oConn.Open(); } catch(Exception oErr) { System.Windows.Forms.MessageBox.Show("\n" + oErr.Message + "\n"); } System.Data.OleDb.OleDbCommand oCmd = new OleDbCommand("PutResult(?,?)",oConn); oCmd.Parameters.Add(new OleDbParameter("cInputID",OleDbType.Char,60,"cInputID")); oCmd.Parameters.Add(new OleDbParameter("cInputResult",OleDbType.Char,4096,"cInputResult")); string cRetVal = oCmd.ExecuteScalar().ToString();>I have a simple stored procedure in my VFP7 DBC for inserting data into a table. I am trying to execute the stored procedure by passing parameters only. The error I get is
>using System; >using System.Data; >using System.Data.OleDb; >OleDbConnection oConn = new OleDbConnection(cConnString); >try >{ oConn.Open(); } >catch(Exception oErr) >{ System.Windows.Forms.MessageBox.Show("\n" + oErr.Message + "\n"); } >System.Data.OleDb.OleDbCommand oCmd = new OleDbCommand(); >oCmd.Connection = oConn; >oCmd.CommandType = CommandType.StoredProcedure; >oCmd.Parameters.Add(new OleDbParameter("cInputID",OleDbType.Char,60,"cInputID")); >oCmd.Parameters.Add(new OleDbParameter("cInputResult",OleDbType.Char,4096,"cInputResult")); >string cRetVal = oCmd.ExecuteScalar().ToString(); >>
> Function PutResult > Lparameters ; > cInputID as String , cInputResult as String > If VarType(cInputID) != "C" > Return 0 > EndIf > If VarType(cInputResult) != "C" > Return 0 > EndIf > If Len(cInputID)< 1 > Return 0 > EndIf > If Len(cInputID)> 24000 > Return 0 > EndIf > Local cIns as String > cIns = "insert into result(cid,mdata) " + ; > "values " + ; > "('" + cInputID + "','" + ; > cInputResult + "')" > &cIns > Return 1 > EndFunc >