datagrid controls

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top