I am trying to connect sql server with vb.net in Visual Studio 2008 with foll. code....
but it is having problem....what is the problem? Please tell me....
1. I created "publication" databse. In table i took 2 columns...fname and lname and fill the records...
2. I took DataGridView onto form and did foll. code....
Public Class Form1
Dim objConnection As SqlConnection = New SqlConnection("server=(local);database=publication;integrated Security=SSPI;")
Dim objDataAdapter As New SqlDataAdapter()
Dim objDataSet As DataSet = New DataSet()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
objDataAdapter.SelectCommand = New SqlCommand()
objDataAdapter.SelectCommand.Connection = objConnection
objDataAdapter.SelectCommand.CommandText = "select * from student"
objDataAdapter.SelectCommand.CommandType = CommandType.Text
grdPublication.DataSource = objDataSet
grdPublication.DataMember = "student"
objDataAdapter = Nothing
objConnection = Nothing
But, it doesn't show any outpou....What to do?
Thanks & Regards,