1
我试图用vb.net连接到SQL服务器,但我得到这个错误:值类型“System.Data.SqlClient.SqlConnection”不能被转换为“1维阵列
Value of type 'System.Data.SqlClient.SqlConnection' cannot be converted to '1-dimensional array of System.Data.SqlClient.SqlConnection'.
此是鳕鱼来源:
Imports System.Data.SqlClient
Public Class Form1
Dim connection As SqlConnection()
Dim reader As SqlDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
connection = New SqlConnection("data source=.; initial catalog=tp2_ado; integrated security = sspi")
Catch ex As Exception
MessageBox.Show(ex.Message())
End Try
End Sub
End Class
为什么在SqlConnection的括号()? –
我在做c#,而我刚刚开始vb.net –
它们在C#中也不需要。 –