private void Button1_Click(object sender, EventArgs e) { // Create the Connection Int32 iRetorno = 1; OleDbConnection cnnConnection = new OleDbConnection(connectionStatement); // Create the command OleDbDataAdapter dx = new OleDbDataAdapter(); DataTable dt = new DataTable(); OleDbCommand cmdCommand = new OleDbCommand("test", cnnConnection); cmdCommand.CommandTimeout = cnnConnection.ConnectionTimeout; cmdCommand.CommandType = CommandType.StoredProcedure; try { cnnConnection.Open(); cmdCommand.Transaction = cnnConnection.BeginTransaction(); cmdCommand.Parameters.Add("iRetorno", OleDbType.Integer, 32).Value = 4; cmdCommand.Parameters["@iRetorno"].Direction = ParameterDirection.Output; --> this is generating error: Variable Q0P0 is not found dx.SelectCommand = cmdCommand; int nreg = dx.Fill(dt); //ax =cmdCommand.ExecuteScalar(); //MessageBox.Show("Retornado: ? " + ax.ToString()); cnnConnection.Close(); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }this is the stored procedure in my database:
PROCEDURE test PARAMETERS iRetorno as Integer CLOSE TABLES ALL SELECT * FROM class1 WHERE pkeyclass1="0O70WYR5U8" INTO CURSOR query1 iRetorno=444 &&dummy number to see if it is changed when "returning" to C# RETURN SETRESULTSET("query1") ENDPROCI need both, the resultset and the variable, the resultset is working fine but the parameter output that i need to be changed on the procedure and returned to C# changed is not working. Any ideas?