how to populate data in data grid from table of sql server

Jul 29 2010 3:35 AM

hello everyone
i should populate the data from table in to data grid but the code i am using below is not working
Private
Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myconnection As New SqlConnection("server=THEJASVI-PC\SQLEXPRESS;database=emp;uid=sa;pwd=2x12")
myconnection.Open()
ds =
New DataSet()
s =
"select * from emp_details"
Dim da As New SqlDataAdapter(s, myconnection)

da.Fill(ds,
"emp_details")
dgvEmployeedetails.DataSource = ds.DefaultViewManager

End Sub
kindly help me to know the correct code

Answers (1)