Dim Conn As SqlClient.SqlConnection
' Try
'连接本地SQL Server数据库
Conn = New SqlClient.SqlConnection()
Conn.Conn ecti onS trin g = "Provider=SQLOLEDB.1;Password=Abc123456;Persist Security Info=True;User ID=admaster;Initial Catalog=shujuku;Data Source=KKSVR4\SQLEXPRESS"
Conn.Open()
Dim StrSQL As String
StrSQL = "U PDATE plcval SET plcvalue = 1 WHERE plc = 'paf2'"
Dim Comm As New SqlClient.SqlCommand(StrSQL, Conn)
Comm.ExecuteNonQuery()
Conn.Close()
MessageBox.Show("数据库连接成功!")
'Catch
' MessageBox.Show("数据库连接有错误!")
' End Try
请教 以上代码 错误在哪 ?
运行时提示 System.ArgumentException:“不支持关键字: “provider”。”
"Provider=SQLOLEDB.1;Password=Abc123456;Persist Security Info=True;User ID=admaster;Initial Catalog=shujuku;Data Source=KKSVR4\SQLEXPRESS"
该内容是从 foxtable 数据源 粘贴出来的.
[此贴子已经被作者于2017/9/2 16:22:13编辑过]