Select data using sqlcommand
selectButton event
It is step3 procedure
protected void btn_select_Click(object sender, EventArgs e) {
sqlgetdata getdata=new sqlgetdata();
classvar seletvar= getdata.searchmain(Convert.ToInt32(TextBox1.Text));
TextBox2.Text = Convert.ToString(seletvar.name);
TextBox3.Text = Convert.ToString(seletvar.course);
TextBox4.Text = Convert.ToString(seletvar.fee);
Label1.Text = "record fetched";
}
Variable class
It is step4 procedure
public class classvar
{
public int id{get;set;}
public string name { get; set; }
public string course { get; set; }
public int fee { get; set; }
}
It is step5 procedure
public classvar searchmain(Int32 ss)
{
Int32 sa = ss;
string sqlquerystring= "select * from student where stu_id="+ sa;
string sqlconstring= "Data Source= SHYAM-6E8C5C74B\\SQLEXPRESS ;initial catalog=college; integrated security=True ";
Sqlcommand sqlcmd=new Sqlcommand(sqlquerystring,sqlcn);
sqlcn.Open();
sqlcn.Open();
SqlDataReader sqlre= sqlcmd.ExecuteReader();
classvar seletvar = new classvar();
while (sqlre.Read())
{
seletvar.fee = re["fee"].ToString();
seletvar.name = re["name"].ToString();
seletvar.course = re["course"].ToString();
}
sqlre.Close();
sqlcn.Close();
return seletvar;
}
See Status of the blog
8 comments:
http://mayurdharukiya.com/
myresume,developer,iphone,android,blackberry,india
http://www.50states.com/"
50 States and Capitals
This is a very nice information and too useful for me on my project work.
Get Free Gift
buy tramadol online tramadol no prescription cod - tramadol hcl and xanax
tramadol without prescription tramadol er 100mg - can buy tramadol online legally
buy tramadol online tramadol legal to buy online - tramadol hcl 50 mg tablet side effects
generic xanax xanax no prior prescription - xanax withdrawal pain
buy tramadol online ultram better than tramadol - tramadol for dogs cost
Post a Comment