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
paparao
NA
7
0
How to insert records into table in database by using asp.net with c#.net?
Jul 28 2007 1:03 AM
HI Frens, I have taken two text textboxs and one button as well as i have created one table with two fields.Now i want to insert records into backend table. Then i have written some code,but it didn't show any exception.however, data didn't insert into table. can anybody rectify my code? string connstring = "server=paparao;uid=sa;pwd=sa;database=training"; SqlConnection cnPrintegra = new SqlConnection(); DataSet dsPrintegra = new DataSet(); cnPrintegra.ConnectionString = connstring; cnPrintegra.Open(); SqlDataAdapter cmdUsers = new SqlDataAdapter("select * from example", cnPrintegra); SqlCommandBuilder cmdb = new SqlCommandBuilder(cmdUsers); cmdUsers.Fill(dsPrintegra, "example"); DataRow cRow ; cRow = dsPrintegra.Tables["example"].NewRow(); cRow[0] = TextBox1.Text; cRow[1] = TextBox2.Text; dsPrintegra.Tables["example"].Rows.Add(cRow); dsPrintegra.AcceptChanges(); cmdUsers.Update(dsPrintegra, "example"); cnPrintegra.Close();
Reply
Answers (
1
)
Remoting custom objects
Printer Status