PC Review


Reply
Thread Tools Rate Thread

datagrid controls

 
 
Robert Smith
Guest
Posts: n/a
 
      21st Aug 2003
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
 
Reply With Quote
 
 
 
 
CJ Taylor
Guest
Posts: n/a
 
      21st Aug 2003
sqldataadatper.update(myDataSet)
myDataSet.AcceptChanges()



"Robert Smith" <(E-Mail Removed)> wrote in message
news:0e8901c36800$c05fd320$(E-Mail Removed)...
> 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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrid and web controls Phil Townsend Microsoft C# .NET 1 16th Jun 2006 11:03 AM
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls thegame Microsoft ASP .NET 1 28th Feb 2005 04:23 PM
Controls in datagrid krallabandi@gmail.com Microsoft Dot NET 0 7th Dec 2004 11:22 AM
DataGrid controls =?Utf-8?B?Qm9uag==?= Microsoft C# .NET 2 11th Nov 2004 10:30 PM
datagrid controls DotNetJunkies User Microsoft ASP .NET 1 15th Jul 2004 01:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:59 AM.