Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello everyone I am trying to develop a application of time table.When you enter the particular data through the form it will get inserted in database, and it will be shown in grid-view. can anyone suggest how to do it.I have taken shift, class(or grade), lecture, day time, teacher, subject as fields for the form.So pls suggest me how to develop it.

C#
protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            string str;
            if (ddl_shift.SelectedValue == "Morning")
            {
                str = "8:00 AM to 9:00 AM," + "Teacher:" + ddl_teacher.SelectedValue + ",Subject:" + ddl_subject.SelectedValue;
            }
            
            con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["atharva-classesConnectionString"].ConnectionString;
            con.Open();
            cmd.Connection = con;
            cmd.CommandText = "ins_timetable";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@shift", ddl_shift.SelectedValue);
            cmd.Parameters.AddWithValue("@class", ddl_class.SelectedValue);
            cmd.Parameters.AddWithValue("@lecture", ddl_lecture.SelectedValue);
            cmd.Parameters.AddWithValue("@lectype",ddl_lecture.SelectedValue);
            cmd.Parameters.AddWithValue("@teacher", ddl_teacher.SelectedValue);
            cmd.Parameters.AddWithValue("@subject", ddl_subject.SelectedValue);
            cmd.Parameters.AddWithValue("@day", ddl_day.SelectedValue);
            cmd.ExecuteNonQuery();
            ddl_class.SelectedValue = "0";
            ddl_day.SelectedValue = "0";
            ddl_lecture.SelectedValue = "0";
            ddl_shift.SelectedValue = "0";
            ddl_subject.SelectedValue = "0";
            ddl_teacher.SelectedValue = "0";
        }
        catch(Exception ex)
        {
            lbl_error.Visible = true;
            lbl_error.Text = ex.ToString();
        }
        finally
        {
            con.Close();
        }
    }
}
Posted

1 solution

first write your thoughts in a paper and complete one by one.

additional,i don't advise that adopt StoredProcedure.
It's not convenient to upgrade.
 
Share this answer
 
v2
Comments
rgboss 26-Jul-13 2:34am    
what is the point that you didn't understood????
Chui PuiKwan 26-Jul-13 2:52am    
Sorry,it's a wide range of requirements.
I wish you can list them more clearly.
Only you konw what you want to do very clearly ,you could done it very well .
rgboss 26-Jul-13 6:31am    
I have done a lot of changes in that code.All I want is a simple form containing fields related to time table. When you enter the data it should be stored in database and I have used a grid-view for showing that data. The fields are shift,class,time,day,teacher,subject. It is like a normal school time table. It is weekly updated.

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