datagrid controls

  • Thread starter Thread starter Robert Smith
  • Start date Start date
R

Robert Smith

Hello, I have the following code that binds a datagrid
(dgcustlist) to a dataset(dsCustomers)

strConn
= "server=MyServer;uid=sa;database=Projects"

Dim currentCursor As Cursor = Cursor.Current

Cursor.Current = Cursors.WaitCursor

'Fill the DataSet

Dim con As SqlConnection = New SqlConnection(strConn)
Dim cmdCustomers = New SqlDataAdapter("Exec
spCustomerList", con)

dsCustomers = New DataSet()
cmdCustomers.FillSchema(dsCustomers,
SchemaType.Source, "spcustomerlist")
cmdCustomers.Fill
(dsCustomers, "spcustomerlist")


dgCustList.DataSource = dsCustomers.Tables!spCustomerlist
cm = CType(Me.BindingContext(dsCustomers.Tables!
spCustomerlist), CurrencyManager)
ts = New DataGridTableStyle(cm)
dgCustList.TableStyles.Add(ts)


This binds the data to the dataset, however
all changes are lost when closing the program,
How do I update the database using the
sqldataapapter and dataset

Thanx in advance
Robert
 
Back
Top