i want to upload the attendance of students

i am able to upload a xlsx file and transfer its data to tbl_temp

now i have two tables

tbl_s_attendance 
EP_Number       Attendance       course_id       class_id
105078 
105076 
105075 
105077 
105079

tbl_Temp 
EP_Number   Attendance
105075      P
105076      P
105077      P
105078      A
105079      A

now i have to put attendance from tbl_temp to tbl_s_attendance according to ep number and il get the values of course_id and class_id from dropdown list of my aspx page

Recommended Answers

All 4 Replies

Member Avatar for LastMitch

now i have to put attendance from tbl_temp to tbl_s_attendance according to ep number and il get the values of course_id and class_id from dropdown list of my aspx page

How does your query looks like? What is your current query? Post your query because noone will write it out.

You can use Update Query for this.. Your logic would be Update attendance by setting the attendance data from tblTemp.. Update the remaining columns using data from your dropdown..

Ummm ... isn't this is a SQL question? You might have better results that way.

As for the dropdown stuff, just grab the DropDownList.SelectedValue for each value, add it to a sql attribute then send it to a stored procedure, something like this:

private void UpdateStudent()
{
    string ddl1 = DropDownList1.SelectedValue;
    string ddl2 = DropDownList2.SelectedValue;
    string studentID  = (string)Session["StudentId"];
    string classID  = (string)Session["classId"];
    string connect = System.Configuration.ConfigurationManager.ConnectionStrings["ConnString"].ToString();
    SqlConnection conn = new SqlConnection(connect);
    string sp = "do_UpdateSomething";
    SqlCommand cmd = new SqlCommand(sp, conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@Param1", ddl1);
    cmd.Parameters.AddWithValue("@Param2", ddl2);
    cmd.Parameters.AddWithValue("@StudentId", studentId);
    cmd.Parameters.AddWithValue("@ClassId", classID);
    conn.Open();
    cmd.ExecuteNonQuery();
    conn.Close();
}

You might want to consider using the Enterprise Library for data work, if you haven't already ... saves a ton of time and effort.
http://msdn.microsoft.com/en-us/library/ff648951.aspx

Can you please share the update query that you are using for updating the attendance sheet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.