TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
umair mohsin
1.4k
387
65.9k
reocrd is not inserted in gridview
Feb 8 2015 12:23 AM
i am having an issue in inserting record in gridview and show it when application runs. i am using executenonquery() method .my code is below.
protected void Page_Load(object sender, EventArgs e)
{
string select = "select * from student_table";
string cs = ConfigurationManager.ConnectionStrings["Database1ConnectionString1"].ConnectionString.ToString();
SqlConnection conn = new SqlConnection(cs);
conn.Open();
SqlCommand cmd = new SqlCommand("insert into student_table (id,name,class) values(1,'danish qamar',6)"+select ,conn);
cmd.CommandType = CommandType.Text;
GridView1.DataSource = cmd.ExecuteNonQuery();
GridView1.DataBind();
conn.Close();
}
by using above code
record is
inserting
in the database
but not displaying when application run
i got following error:
Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
help me to solve it please.
Reply
Answers (
5
)
Save multiple texbox insert in one string
how to show alert while daleteing record