Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Oledbconnection between C# and .DBC can read output params?
Message
From
09/05/2008 11:03:50
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Oledbconnection between C# and .DBC can read output params?
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01316082
Message ID:
01316082
Views:
138
Hi all, i have this code in C#: that opens a connection to a .dbc and execute a stored procedure, i need 1 parameter be changed on procedure and return to C# with a new value, the resultset is working ok.
        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")
ENDPROC
I 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?
T.I.A.
John Harold Belalcázar Lozano
Associate Director Of Development
http://www.belvicto.co/
jhbelalc@gmail.com
Next
Reply
Map
View

Click here to load this message in the networking platform