Click here to Skip to main content
15,886,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
DataTable dt = new DataTable();
            
//Open Connection
try
{
    string conHostName = "172.21.0.45";
    string conPort = "1522";
    string conDatabase = "ora11gv4";
    string _dbUserName = "ScibasePD";
    string _dbPwd = "ScibasePD";

    string conStr = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1})))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={2})));User Id={3};Password={4};",
                     conHostName, conPort, conDatabase, _dbUserName, _dbPwd);

    OracleConnection con = new OracleConnection(conStr);
    con.Open();
    // define Command
    using (OracleCommand cmd = new OracleCommand())
    {
          //// create & define the parameter
          //var refCursorParam = new OracleParameter();
          //refCursorParam.ParameterName = "";
          //refCursorParam.OracleType = OracleType.Cursor;
          //refCursorParam.Direction = ParameterDirection.Output;
          
          cmd.Connection = con;
          cmd.CommandType = CommandType.StoredProcedure;
          cmd.CommandText = "REPORTS.GET_DAILY_STATUS";
                    
          //define the data adapter and fill the dataset
          using (OracleDataAdapter oda = new OracleDataAdapter(cmd))
          {
              oda.Fill(dt);
          }
     }
           bindingSource1.DataSource = dt;
}
catch (Exception ex)
{
     throw ex;
}
Posted
Updated 17-May-12 21:26pm
v3
Comments
Member 8983639 18-May-12 2:55am    
var refCursorParam = new OracleParameter(); how to use this
Oshtri Deka 18-May-12 3:27am    
Edit: code formatting.

1 solution

You missing Step
bindingSource1.DataBind();

Rest
Hope this link Help you:
http://stackoverflow.com/questions/6491159/c-sharp-oracle-execute-stored-procedure-with-output-parameter[^]
 
Share this answer
 
v2
Comments
Member 8983639 18-May-12 3:29am    
thanks alot for the help :) i ll try it
Member 8983639 18-May-12 3:35am    
im unable to get it kindly help me how to bind to datagridview1. OracleParameter() i have two parameters from date and to date in my stored procedure when i select from date and to date textbox and click button

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900