Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
#region course selected index
        private void CB_Course_SelectedIndexChanged(object sender, EventArgs e)
        {
            coursewisereport();
        }
        #endregion


C#
#region grid coursewisereport
        private void coursewisereport()
        {
            try
            {
                objdatabaseclass = new DataBaseClass();
                objstudentlistclass = new property_function_class.StudentListClass();
                objstudentlistclass.COURS = CB_Course.Text.Trim();
                dataset = objstudentlistclass.Getcoursewisereport();
                dbBindSource.DataSource = dataset;
                DbGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
                DbGrid.DataSource = dbBindSource;
            }
            catch
            {
                MessageBox.Show("selected data not in db");
            }
        }
        #endregion


studentlistclass.cs
----------------------------
C#
#region getcoursewisereport function
        public DataSet Getcoursewisereport()
        {
            DataBaseClass objdatabaseclass = new DataBaseClass();
            dataset = new DataSet();
            dataset = objdatabaseclass.GetDataset(string.Format("select studentid,name,nameofgud,location,mobile from registration where course='" + course + "'"));
            return dataset;
        }
        #endregion



--------------------

databaseclass.cs
---------------
C#
public DataSet GetDataset(string ProcedureName)
        {
            try
            {
                Objcommand = new OracleCommand(ProcedureName, Objconnection);
                Objcommand.CommandType = CommandType.Text;

                // Handle the parameters

                Objadapter = new OracleDataAdapter(Objcommand);
                objcommandbuilder = new OracleCommandBuilder(Objadapter);
                Objdataset = new DataSet();
                Objdataset.Locale = System.Globalization.CultureInfo.InvariantCulture;
                Objadapter.Fill(Objdataset);
            }

            catch (Exception Objerrormessage)
            {
                throw Objerrormessage;
            }
            finally
            {
                //release all resource of connection object
                Objconnection.Dispose();

            }
            return Objdataset;

        }
Posted
Updated 4-Nov-13 22:49pm
v4
Comments
ZurdoDev 5-Nov-13 7:36am    
Why can't you show data?
Dave Vroman 5-Nov-13 19:00pm    
Have you tried the code without the error handling. This is normally my first step. I want to see what is wrong and then I add error handling.
ravuravu 5-Nov-13 23:38pm    
error starts from the line of "Objadapter = new OracleDataAdapter(Objcommand);",here from the value does not get to the oracledataadapter

1 solution

well what about the Objconnection in GetDataset method is it open, and active
 
Share this answer
 
v2
Comments
ravuravu 5-Nov-13 23:36pm    
#region connection
public DataBaseClass()
{
//DbConnection.Connect();
Objconnection = new OracleConnection(@"Data Source=xe;User ID=insta;Password=insta");
Objconnection.Open();
}
#endregion

ya it is opened
Thava Rajan 6-Nov-13 4:18am    
i have some doubts there?,
well what is the type of objCommand,
is the select query construct correctly,
ravuravu 6-Nov-13 4:59am    
i got it ,me used datatable instead of dataset
ravuravu 6-Nov-13 4:58am    
i got it when i use datatable instead of dataset ,i got it

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