Hello
Well after reading books and doing some research I finnaly got it working. First I right click on my DataGrid and select Property Builder. Then I select Column and added a Bound Column to my Datagrid. Over here is where you name your columns, So lets says you have a table with the following columns FName,LName. On the bound column you just add FName WHERE it says Data Field and FName where is says Header text, Next add another bound column and Type in LName in the data field and type in LName in the header text. Now we are ready to Connect to tha database and Bind the data to the Datagrid.
Add the following IMPORTS
Code:
Imports System.Data
Imports System.Data.Common
Imports System.Data.SqlClient
Imports System.Data.SqlDbType
Imports System.Data.SqlTypes
This is where i conect to my Database
Code:
Dim MyConnection As SqlConnection = New SqlConnection("server='YourComputerName\Your InstanceName';initial catalog='YourDatabase';user id=UserID;password='Password';")
Dim MyDataAdapter As New SqlDataAdapter
Dim MyDataset As New DataSet
Now Bind the Data to your DataGrid
'Bind the Data to the Data Grid
Code:
MyDataAdapter.SelectCommand = New SqlCommand
Code:
MyDataAdapter.SelectCommand.Connection = MyConnection
MyDataAdapter.SelectCommand.CommandText = "Select * From UserInfo"
MyConnection.Open()
MyDataAdapter.SelectCommand.ExecuteScalar.ToString()
MyConnection.Close()
MyDataAdapter.Fill(MyDataset, "UserInfo")
Me.DataGridItemsonHold.DataSource = MyDataset
Me.DataGridItemsonHold.DataBind()
Thanks
Sincerely; Oscar Martinez