Hi....
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....
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
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
objConnection.Open()
objDataAdapter.Fill(objDataSet, "student")
objConnection.Close()
grdPublication.DataSource = objDataSet
grdPublication.DataMember = "student"
objDataAdapter = Nothing
objConnection = Nothing
End Sub
End Class
But, it doesn't show any outpou....What to do?
Thanks & Regards,
Pooja.