Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim conStr As String = "Data Source=.\SQLEXPRESS;AttachDbFilename='C:\Users\Pode\Documents\Visual Studio 2012\Projects\Northwind.mdf';Integrated Security=True;User Instance=True"
Dim conn As New SqlConnection(conStr)
conn.Open()
MessageBox.Show("Success")
End Sub
End Class
为何错误conn.Open()
?