Hi Tony,
I'm sending two examples in the .Net using C#, and a class in cache that
both examples call.
HTH,
Luiz Papa
Query example (In this case you have a cach� query in the class Class1):
string sConnection = "DRIVER={Intersystems
ODBC};SERVER=MYSERVER;PORT=1972;PROTOCOL=TCP;UID=_SYSTEM;DATABASE=USER;PWD=S
YS";
OdbcConnection objConnection = new OdbcConnection(sConnection);
string sQuery = "CALL SQLUser.Class1_QueryTest(?)";
OdbcDataAdapter objDataAdapter = new OdbcDataAdapter(sQuery, objConnection);
OdbcParameter param1 = objDataAdapter.SelectCommand.Parameters.Add("State",
"FL");
param1.Value = "FL";
DataTable dttTest = new DataTable();
objDataAdapter.Fill(dttTest);
Stored procedure with an return value (In this case you have a stored in
Class1 that receives a parameter and returns a string):
string sConnection = "DRIVER={Intersystems
ODBC};SERVER=MYSERVER;PORT=1972;PROTOCOL=TCP;UID=_SYSTEM;DATABASE=USER;PWD=S
YS";
OdbcConnection objConnection = new OdbcConnection(sConnection);
objConnection.Open();
string sQuery = "?=CALL SQLUser.Class1_ProcedureTest(?)";
OdbcCommand cmdProc = new OdbcCommand(sQuery, objConnection);
cmdProc.Parameters.Add("Return",OdbcType.VarChar,255);
cmdProc.Parameters["Return"].Direction = ParameterDirection.ReturnValue;
cmdProc.Parameters.Add("State", "FL");
cmdProc.CommandType = CommandType.StoredProcedure;
cmdProc.ExecuteNonQuery();
On Cache:
Class User.Class1 Extends %Persistent [ ClassType = persistent,
ProcedureBlock ]
{
Property State As %String(MAXLEN = 2);
Property City As %String;
ClassMethod ProcedureTest(State As %String) As %String [ SqlProc ]
{
&SQL(SELECT TOP 1 State FROM Class1 WHERE State=:State)
I %RowCount=0 Q "Not Exist"
Q "Exist"
}
Query QueryTest(State As %String) As %SQLQuery [SqlProc]
{
SELECT City,State FROM Class1
WHERE State=:State
}
}
"Tony Yates" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
> Hi all, does anyone have any examples of calling a cache stored proc via
> ODBC from .net ?
>
> Kind Regards
> Tony
>
>