protected void BtnRegister_Click(object sender, EventArgs e) { try { String qry = "insert into tbStudent(SName,SFatherName,SAddress,SMobile,Sclass,SDob) values('" + txtName.Text + "','" + TxtFatherName.Text + "','" + txtAddress.Text + "','" + TxtmobileNo.Text + "','" + TxtClass.SelectedItem.ToString() + "','" + TxtDob.Text + "')"; obj.InsDelUpdt(qry); qry = ""; qry = "select * from tbStudent ORDER BY Id DESC"; tbl = new DataTable(); tbl = obj.Srch(qry); rslt.InnerHtml = "Student got admission and his Unique Id is=" + tbl.Rows[0]["id"].ToString(); } catch (Exception es) { rslt.InnerHtml = "Check the record before Submitting"; } }
protected void btnFee_Click(object sender, EventArgs e) { DateTime dt = DateTime.UtcNow.Date; // rslt.InnerHtml =; try { String qry = "insert into tbFee(UniqID,Fee,Sdate) values(" + Convert.ToInt32(txtId.Text) + "," + Convert.ToInt32(txtFee.Text.ToString()) + ",'" + dt.ToString("dd/MM/yyyy") + "')"; obj.InsDelUpdt(qry); rslt.InnerHtml = "Fee Paid "; txtId.Text = ""; txtFee.Text = ""; } catch (Exception ex) { rslt.InnerHtml = "There is some error please check it "; } }
protected void Page_Load(object sender, EventArgs e) { try { String recrd = "<table><tr><td>Unique ID</td><td>Name</td><td>Father Name</td><td>Class</td><td>Address</td><td>Mobile No</td><td>Dob</td><td>delete</td><td>Update</td></tr>"; DataTable tbl = new DataTable(); String qry = "select * from tbStudent"; tbl = obj.Srch(qry); if (tbl.Rows.Count > 0) { for (int x = 0; x < tbl.Rows.Count; x++) { recrd = recrd + "<tr><td>" + tbl.Rows[x]["id"] + "</td><td>" + tbl.Rows[x]["SName"] + "</td>"; recrd = recrd + "<td>" + tbl.Rows[x]["SFatherName"] + "</td>"; recrd = recrd + "<td>" + tbl.Rows[x]["Sclass"] + "</td>"; recrd = recrd + "<td>" + tbl.Rows[x]["SAddress"] + "</td>"; recrd = recrd + "<td>" + tbl.Rows[x]["SMobile"] + "</td>"; recrd = recrd + "<td>" + tbl.Rows[x]["SDob"] + "</td>"; recrd = recrd + "<td><a href='ViewStudent.aspx?id=" + tbl.Rows[x]["id"] + "' class='btn-primary' style='border:5px ridge green;height:10px;padding:10px;'>Delete</td>"; recrd = recrd + "<td><a href='UpdateStudent.aspx?id=" + tbl.Rows[x]["id"] + "#Record' class='btn-primary' style='border:5px ridge green;height:10px;padding:10px;'>Update</td></tr>"; } rslt.InnerHtml = recrd + "</table>"; } else { rslt.InnerHtml = "record is empty"; } if (Request.QueryString["id"] != null) { qry = ""; qry = "delete from tbStudent where id=" + Convert.ToInt32(Request.QueryString["id"].ToString()) + ""; obj.InsDelUpdt(qry); Response.Redirect("ViewStudent.aspx?#Record"); } } catch (Exception es) { rslt.InnerHtml = "error in the code"; } }
protected void BtnUpdate_Click(object sender, EventArgs e) { try { //rslt.InnerHtml = txtAddress.Text + "--" + TxtClass.Text + "--" + TxtDob.Text + "--" + TxtFatherName.Text + "--" + TxtId.Text + "--" + TxtmobileNo.Text + "--" + txtName.Text; String qry = "Update tbStudent set SName='" + txtName1.Text + "',SFatherName='" + TxtFatherName1.Text + "',SAddress='" + txtAddress1.Text + "',SMobile='" + TxtmobileNo1.Text + "',Sclass='" + TxtClass1.Text + "',SDob='" + TxtDob1.Text + "' where ID='" + Convert.ToInt32(TxtId1.Text) + "'"; obj.InsDelUpdt(qry); txtName1.Text = ""; txtAddress1.Text = ""; TxtDob1.Text = ""; TxtFatherName1.Text = ""; TxtId1.Text = ""; TxtmobileNo1.Text = ""; id = ""; Response.Redirect("ViewStudent.aspx?#Record"); } catch (Exception rs) { rslt.InnerHtml = "Error "; } }
protected void Page_Load(object sender, EventArgs e) { try { String recrd = "<table><tr><td>Unique ID </td><td>Fee</td><td>Date</td><td>delete</td></tr>"; DataTable tbl = new DataTable(); String qry = "select * from tbFee"; tbl = obj.Srch(qry); if (tbl.Rows.Count > 0) { for (int x = 0; x < tbl.Rows.Count; x++) { recrd = recrd + "<tr><td>" + tbl.Rows[x]["UniqID"] + "</td>"; recrd = recrd + "<td>" + tbl.Rows[x]["Fee"] + "</td>"; recrd = recrd + "<td>" + tbl.Rows[x]["Sdate"] + "</td>"; recrd = recrd + "<td><a href='ViewFee.aspx?id=" + tbl.Rows[x]["id"] + "' class='btn-primary' style='border:5px ridge green;height:10px;padding:10px;'>Delete</td></tr>"; } rslt.InnerHtml = recrd + "</table>"; } else { rslt.InnerHtml = "record is empty"; } if (Request.QueryString["id"] != null) { qry = ""; qry = "delete from tbFee where id=" + Convert.ToInt32(Request.QueryString["id"].ToString()) + ""; obj.InsDelUpdt(qry); Response.Redirect("ViewFee.aspx"); } } catch (Exception rs) { rslt.InnerHtml = "check the Code "; } }