I'm developing an application for my psing SQL Server 2005 as database and VB.Net 2008. Ive created the form and successfully connected all text boxes etc. Using the code, I have managed to open the database and fill the dataset. However when i BIND the Datagrid datasource to the Dataset, I can only see the COLUMN NAMES in the datagrid and not the rows or the data. Can someone please analyze my code and tell me whats wrong?
Also I'd be really grateful if you guys could tell me how to Insert, Update and Delete data.
I'm fairly new to VB.Net but I have used VB6 before
Thanks in advance
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click Dim con As New OleDb.OleDbConnection Dim dbprovider As String Dim dbsource As String Dim ds As New DataSet Dim da As New OleDb.OleDbDataAdapter Dim sql As String dbprovider = "Provider=SQLOLEDB;Integrated Security=SSPI;" dbsource = "Data Source=THOR\SQLEXPRESS" con.ConnectionString = dbprovider & dbsource con.Open() sql = "SELECT [Company Name],[Representative Name],[Street],[City],[State],[Zip Code],[Country],[Phone],[Fax],[Mobile],[Email],[Notes] FROM [Project].[dbo].[customer]" da = New OleDb.OleDbDataAdapter(sql, con) da.Fill(ds, "AddressBook") MsgBox("Database is now open") con.Close() MsgBox("Database is now Closed") DataGridView1.DataSource = ds End Sub