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
George
NA
3
0
Update with DatagridView
Aug 13 2010 11:05 AM
Hello !
I want to update database(when I click the button1) with the value who I changed in a DatagridView, but I don't know how:
private void button1_Click(object sender, EventArgs e)
{
string connString = @"server = evil\sqlexpress;
Database = Punctaje.mdf;
trusted_connection = True;
AttachDbFileName = C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Punctaje.mdf;";
DataGridViewCell cell = this.dataGridView1.CurrentCell; // ?!
string sql2 = "UPDATE Studenti SET Nume='" +cell.Value.ToString()+ "' "; //?!
SqlConnection conn = null;
SqlDataReader reader2 = null;
using (conn = new SqlConnection(connString))
{
conn.Open();
SqlCommand cmd2 = new SqlCommand(sql2, conn);
reader2 = cmd2.ExecuteReader();
reader2.Close();
}
}
Reply
Answers (
1
)
how to auto logon my intra website ?
How to use autocomplete from database column