|
-
Jan 7th, 2003, 09:31 AM
#12
New Member
nswan - you cannot use datareader to bind to a datagrid in windows forms. Youll have to use a dataset
Dim data_adapter As SqlDataAdapter
data_adapter = New SqlDataAdapter("SELECT * FROM Contacts ORDER BY LastName, FirstName", objConn)
' Map Table to Contacts.
data_adapter.TableMappings.Add("Table", "Contacts")
' Fill the DataSet.
m_DataSet = New DataSet()
data_adapter.Fill(m_DataSet)
' Bind the DataGrid control to the Contacts DataTable.
datagrid1.DataSource = m_DataSet.Tables("Contacts")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|