Connecting Tech Pros Worldwide Forums | Help | Site Map

Datgrid Datable question

Sl1ver's Avatar
Member
 
Join Date: Mar 2009
Location: Cape Town, South Africa
Posts: 103
#1: 3 Weeks Ago
Hi
Doesn't the grid that you create, create its own datatable that you can use in the program, meaning for a update code that i want to use with my datagrid i need a datable, but that means i have to create dataset and sql queries and everything, doesn't the grid have the sql queries already?

Expand|Select|Wrap|Line Numbers
  1. private void gridControl1_EmbeddedNavigator_Click(object sender, EventArgs e)
  2.         {
  3.  
  4.                 if (MessageBox.Show("Do you want to add this row", "Confirm deletion",
  5.                     MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) != DialogResult.Yes)
  6.                 //    e.Handled = true;
  7.                 //if (e.Handled == true)
  8.                 //{
  9.                     UpdateDatasource(gridControl1);
  10.                 //}
  11.  
  12.         }
  13.  
  14.         public void UpdateDatasource(GridControl grid)
  15.         {
  16.             //Save the latest changes to the bound DataTable
  17.             ColumnView View = (ColumnView)grid.FocusedView;
  18.             if (!(gridView1.PostEditor() && View.UpdateCurrentRow())) return;
  19.             DataTable dtReport = new DataTable();
  20.             //Update the database's Suppliers table to which oleDBDataAdapter1 is connected
  21.             DoUpdate(qx_AssetInventoryTableAdapter, what do i use here??);
  22.             //Update the database's Products table to which the oleDbDataAdapter2 is connected
  23.  
  24.         }
  25.  
  26.         public void DoUpdate(DbDataAdapter dataAdapter, System.Data.DataTable dataTable)
  27.         {
  28.             try
  29.             {
  30.                 dataAdapter.Update(dataTable);
  31.             }
  32.             catch (Exception ex)
  33.             {
  34.                 MessageBox.Show(ex.Message);
  35.             }
  36.         }
  37.  

Reply