主题:!!帮忙看一下这段连数据库代码,报错
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim connstr, selectcmd As String
connstr = "datasurce=localhost;intital catalog=jxc;uid='';pwd=''"
selectcmd = "select * from usertable"
Dim conn As SqlConnection, cmd As SqlCommand
conn = New SqlConnection(connstr)
conn.Open()
cmd = New SqlCommand(selectcmd, conn)
cmd.ExecuteNonQuery()
conn.Close()
End Sub
点按钮就报错> jx.exe!jx.Form2.Button3_Click(Object sender = {System.Windows.Forms.Button}, System.EventArgs e = {System.EventArgs}) 行181 + 0x17 字节 Basic
Dim connstr, selectcmd As String
connstr = "datasurce=localhost;intital catalog=jxc;uid='';pwd=''"
selectcmd = "select * from usertable"
Dim conn As SqlConnection, cmd As SqlCommand
conn = New SqlConnection(connstr)
conn.Open()
cmd = New SqlCommand(selectcmd, conn)
cmd.ExecuteNonQuery()
conn.Close()
End Sub
点按钮就报错> jx.exe!jx.Form2.Button3_Click(Object sender = {System.Windows.Forms.Button}, System.EventArgs e = {System.EventArgs}) 行181 + 0x17 字节 Basic