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
Israel
700
1.3k
217.6k
Refreshing my database
Jul 16 2014 9:10 AM
Hi!
I want to refresh my database after saving my records. I cant do that... But I wrote this line of code in red (without success):
Have a look please:
conn = new SqlConnection(connstr);
comm = new SqlCommand();
conn.Open();
SqlParameter firstname = new SqlParameter("@firstname", SqlDbType.VarChar);
SqlParameter lastname = new SqlParameter("@lastname", SqlDbType.VarChar);
comm.Parameters.Add(firstname);
comm.Parameters.Add(lastname);
firstname.Value = txtfirstname.Text;
lastname.Value = txtlastname.Text;
comm.Connection = conn;
comm.CommandText = "insert into test values(@firstname,@lastname)";
try
{
comm.ExecuteNonQuery();
dgv.CurrentCell = dgv.Rows[dgv.Rows.Count - 1].Cells[0];
//Here
MessageBox.Show("Saved!");
}
catch (Exception)
{
MessageBox.Show("Not saved");
}
finally
{
conn.Close();
}
}
}
Reply
Answers (
4
)
how to add datatable filtering Search to a asp.net
Can some one help me to do like Below image in gridview