Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 18th, 2012  |  syntax: None  |  size: 0.54 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. DateTimePicker value not regarded when updating datagridview to SQL Server
  2. SqlDataAdapter dataAdapter = new SqlDataAdapter("Select * From EDI;", conn.ConnectionString);
  3. SqlCommandBuilder cb = new SqlCommandBuilder(dataAdapter);
  4. dataAdapter.UpdateCommand = cb.GetUpdateCommand();                
  5. dataAdapter.Update(dataSet, "EDI");
  6.        
  7. private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
  8. {
  9.         dataGridView1.CurrentCell.Value = dateTimePicker1.Value.ToShortDateString();
  10.         dateTimePicker1.Visible = false;          
  11. }