public List <clsregprp> fnd_rec(Int32 regcod) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("fndreg", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@regcod", SqlDbType.Int).Value = regcod; SqlDataReader dr = cmd.ExecuteReader(); List <clsregprp> obj = new List <clsregprp>(); if (dr.HasRows) { dr.Read(); clsregprp x = new clsregprp(); x.regcod = Convert.ToInt32(dr[0]); x.regeml = dr[1].ToString(); x.regpwd = dr[2].ToString(); x.regdat = Convert.ToDateTime(dr[3]); x.regsts = Convert.ToChar(dr[4]); obj.Add(x); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public List <clsregprp> dsp_rec() { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("dspreg", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); List <clsregprp> obj = new List <clsregprp>(); while (dr.Read()) { clsregprp x = new clsregprp(); x.regcod = Convert.ToInt32(dr[0]); x.regeml = dr[1].ToString(); x.regpwd = dr[2].ToString(); x.regdat = Convert.ToDateTime(dr[3]); x.regsts = Convert.ToChar(dr[4]); obj.Add(x); } dr.Close(); cmd.Dispose(); con.Close(); return(obj); }
public void del_rec(clsregprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delreg", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@regcod", SqlDbType.Int).Value = p.regcod; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
public void save_rec(clsregprp p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("insreg", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@regeml", SqlDbType.VarChar, 50).Value = p.regeml; cmd.Parameters.Add("@regpwd", SqlDbType.VarChar, 50).Value = p.regpwd; cmd.Parameters.Add("@regdat", SqlDbType.DateTime).Value = p.regdat; cmd.Parameters.Add("@regsts", SqlDbType.Char, 1).Value = p.regsts; cmd.ExecuteNonQuery(); cmd.Dispose(); con.Close(); }
protected void Button1_Click(object sender, EventArgs e) { nsskills.clsreg obj = new nsskills.clsreg(); nsskills.clsregprp objprp = new nsskills.clsregprp(); objprp.regeml = txteml.Text; objprp.regpwd = txtpwd.Text; objprp.regdat = DateTime.Now; objprp.regsts = 'U'; try { obj.save_rec(objprp); Label1.Text = "Registration Successful"; } catch (Exception exp) { Label1.Text = "Registration Not Successful"; } }