public List <clsqstprp> fnd_rec(Int32 qstcod) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("fndqst", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@qstcod", SqlDbType.Int).Value = qstcod; SqlDataReader dr = cmd.ExecuteReader(); List <clsqstprp> obj = new List <clsqstprp>(); if (dr.HasRows) { dr.Read(); clsqstprp x = new clsqstprp(); x.qstcod = Convert.ToInt32(dr[0]); x.qstteccod = Convert.ToInt32(dr[1]); x.qstdsc = dr[2].ToString(); x.qstlvl = Convert.ToChar(dr[3]); x.qstdat = Convert.ToDateTime(dr[4]); obj.Add(x); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public List <clsqstprp> dspqstbyteclvl(Int32 teccod, char lvl) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dspqstbyteclvl", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@teccod", SqlDbType.Int).Value = teccod; cmd.Parameters.Add("@lvl", SqlDbType.Char, 1).Value = lvl; SqlDataReader dr = cmd.ExecuteReader(); List <clsqstprp> obj = new List <clsqstprp>(); while (dr.Read()) { clsqstprp x = new clsqstprp(); x.qstcod = Convert.ToInt32(dr[0]); x.qstteccod = Convert.ToInt32(dr[1]); x.qstdsc = dr[2].ToString(); x.qstlvl = Convert.ToChar(dr[3]); x.qstdat = Convert.ToDateTime(dr[4]); obj.Add(x); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { nsskills.clsqst obj = new nsskills.clsqst(); nsskills.clsqstprp objprp = new nsskills.clsqstprp(); objprp.qstcod = Convert.ToInt32(GridView1.DataKeys[e.RowIndex][0]); obj.del_rec(objprp); GridView1.DataBind(); e.Cancel = true; }
public void del_rec(clsqstprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delqst", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@qstcod", SqlDbType.Int).Value = p.qstcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
public void save_rec(clsqstprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insqst", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@qstteccod", SqlDbType.Int).Value = p.qstteccod; cmd.Parameters.Add("@qstdsc", SqlDbType.NVarChar, 2000).Value = p.qstdsc; cmd.Parameters.Add("@qstlvl", SqlDbType.Char, 1).Value = p.qstlvl; cmd.Parameters.Add("@qstdat", SqlDbType.DateTime).Value = p.qstdat; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
protected void Button1_Click(object sender, EventArgs e) { nsskills.clsqst obj = new nsskills.clsqst(); nsskills.clsqstprp objprp = new nsskills.clsqstprp(); objprp.qstteccod = Convert.ToInt32(DropDownList1.SelectedValue); objprp.qstlvl = Convert.ToChar(DropDownList2.SelectedValue); objprp.qstdsc = TextBox1.Text; objprp.qstdat = DateTime.Now; if (Button1.Text == "Submit") { obj.save_rec(objprp); } else { objprp.qstcod = Convert.ToInt32(Request.QueryString["qcod"]); obj.upd_rec(objprp); } Response.Redirect("frmqstbnk.aspx"); }