this is my code for connection... i'm new in VB.Net so please help me for this
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cnn As New SqlConnection("Data Source=.\SQLExpress, Initial Catalog=\SQLSAMPLE.mdf; Integrated Security=True")
Dim cmm As New SqlCommand("SELECT * FROM sample", cnn)
Try
cnn.Open()
cmm.ExecuteReader()
Catch ex As Exception
MsgBox("Failed")
Finally
cnn.Close()
End Try
End Sub
End Class
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cnn As New SqlConnection("Data Source=.\SQLExpress, Initial Catalog=\SQLSAMPLE.mdf; Integrated Security=True")
Dim cmm As New SqlCommand("SELECT * FROM sample", cnn)
Try
cnn.Open()
cmm.ExecuteReader()
Catch ex As Exception
MsgBox("Failed")
Finally
cnn.Close()
End Try
End Sub
End Class