hi,
i was using .net1.1.. now i am using .net2.0 and sqlserver2005
in my form i have a datagrid and i want view the contents of contents of table how write the code in vb.net 2.0.. i tried the following code but its not working
plz help me
i was using .net1.1.. now i am using .net2.0 and sqlserver2005
in my form i have a datagrid and i want view the contents of contents of table how write the code in vb.net 2.0.. i tried the following code but its not working
plz help me
Code:
Imports System.Data.SqlClient
Public Class Form1
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim con As New SqlConnection("Data Source=localhost; Initial Catalog=N0C7G6\Databases\company; Integrated Security=SSPI")
Dim ad As New SqlDataAdapter("select * from emp", con)
Dim ds As New DataSet
ad.Fill(ds)
DataGridView1.DataSource = ds
DataGridView1.DataBindings()
End Sub
Comment