how do i display the inserted record in gridview in asp.net when i click on button..?

GridView1.DataSource = a.filldata("insert into student(Roll_no,Name,Age,Education,Mobile)values("+txtrollno.Text +",'"+txtname.Text +"',"+txtage.Text +",'"+txtedu.Text +"',"+txtmb.Text+")");
GridView1.DataBind();

i want it should be display right now at runtime record should be added....and displayed...
and i also get and error of "," i dont know how...and its of nonexecutequery()

update := GridView1.DataSource = a.filldata("update student set Roll_no="+txtrollno.Text +"where Roll_no=" + txtrollno.Text + ",Name='" + txtname.Text + "',Age=" + txtage.Text + ",Education='" + txtedu.Text + "',Mobile=" + txtmb.Text + ")");
GridView1.DataBind();

plzz help...

Recommended Answers

All 4 Replies

In my query's i do UPDATE X SET Y = '"+ blah.text + "',Z='" + bzla.text...... hope that helps a bit... more code would help me see better.

thnx

Hi

Generally GridView is used to show data in tabular format. It also provide ways to modify and delete records.

If you want to more detail about it and want to get code for display record than just go for below link.

http://www.dotnetfunda.com/articles/article180.aspx

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.