none
storing value in datatable RRS feed

  • Question

  • hi this is my code

    OracleDataAdapter

    da12 = new OracleDataAdapter("Select Length from b$e_conseg_n where G3E_FID=('" + dt4.Rows[d][0] + "')", conn);

    da12.Fill(dt12);

    but it is showing error

    Arithmatic operation result resulted is an overflow......

    

    • Moved by eryang Thursday, May 19, 2011 2:14 AM Move to ADO.NET forum for better support. (From:.NET Base Class Library)
    Wednesday, May 18, 2011 10:11 AM

Answers

  • Hello bro,

    Thanks for your post.

    The following C# example demonstrates how you might obtain table and column information using the stored procedure.

    // GetConnectionString() returns a connection string for
    // the data source.
    
    string connString = GetConnectionString();
    DataSet ds = new DataSet();
    OracleConnection conn = new OracleConnection(connString);
    OracleCommand cmd = conn.CreateCommand();
    
    cmd.CommandText = "CURSPKG.OPEN_TWO_CURSORS";
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add("EMPCURSOR", OracleType.Cursor).Direction = 
        ParameterDirection.Output;
    cmd.Parameters.Add("DEPTCURSOR", OracleType.Cursor).Direction = 
        ParameterDirection.Output;
    
    OracleDataAdapter da = new OracleDataAdapter(cmd);
    da.TableMappings.Add("Table", "Emp");
    da.TableMappings.Add("Table1", "Dept");
    da.Fill(ds);
    
    ds.Relations.Add("EmpDept", ds.Tables["Dept"].Columns["Deptno"], 
       ds.Tables["Emp"].Columns["Deptno"], false);

     

    I hope this can help you. If you have any questions, please feel free to let me know.

     

    Have a nice day,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 23, 2011 7:18 AM
    Moderator

All replies

  • Why don't you use a Command and call ExecuteScalar ? you can manually create a datatable afterwards, add a row and the value.
    Wednesday, May 18, 2011 3:39 PM
  • Hello bro,

    Thanks for your post.

    The following C# example demonstrates how you might obtain table and column information using the stored procedure.

    // GetConnectionString() returns a connection string for
    // the data source.
    
    string connString = GetConnectionString();
    DataSet ds = new DataSet();
    OracleConnection conn = new OracleConnection(connString);
    OracleCommand cmd = conn.CreateCommand();
    
    cmd.CommandText = "CURSPKG.OPEN_TWO_CURSORS";
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add("EMPCURSOR", OracleType.Cursor).Direction = 
        ParameterDirection.Output;
    cmd.Parameters.Add("DEPTCURSOR", OracleType.Cursor).Direction = 
        ParameterDirection.Output;
    
    OracleDataAdapter da = new OracleDataAdapter(cmd);
    da.TableMappings.Add("Table", "Emp");
    da.TableMappings.Add("Table1", "Dept");
    da.Fill(ds);
    
    ds.Relations.Add("EmpDept", ds.Tables["Dept"].Columns["Deptno"], 
       ds.Tables["Emp"].Columns["Deptno"], false);

     

    I hope this can help you. If you have any questions, please feel free to let me know.

     

    Have a nice day,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 23, 2011 7:18 AM
    Moderator