Welcome to Sign in | Help
in Search

Update cu DatagridView

Last post 08-14-2010, 5:33 PM by ignatandrei. 1 replies.
Sort Posts: Previous Next
  •  08-14-2010, 1:55 PM 8396

    Update cu DatagridView

    Am urmatorul cod:

    private void button1_Click(object sender, EventArgs e)
            {
                string connString = @"server = eu\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();
                }

            }

    Dupa ce modific date in datagridview si apoi apas pe button1, vreau ca sa se updateze datele si in datagridview. Cum scriu codul ?
    Va multumesc anticipat pentru raspuns.

  •  08-14-2010, 5:33 PM 8397 in reply to 8396

    Re: Update cu DatagridView

    fa-i din nou bind-ul ca sa isi traga datele...

    Ignat Andrei
    http://serviciipeweb.ro/iafblog
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems