我正在创建一个 vb.net 应用程序,其中出现错误“我不知道如何解决此错误,并且表中有 4 个字段,'System.Data.SqlClient.SqlException'
发生了第一次机会异常类型System.Data.dll"
- o_id 主键自动递增 1
c_id
静止的- 所有者名称
varchar()
投资
Dim connetionString As String Dim cnn As SqlConnection Dim cmd As New SqlCommand connetionString = "Data Source=.\SQLEXPRESS;AttachDbFilename='C:\Users\javed\Documents\Visual Studio 2008\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\Database1.mdf';Integrated Security=True;User Instance=True" cnn = New SqlConnection(connetionString) Try cnn.Open() MsgBox("Connection is Open ! ") cmd.Connection = cnn cmd.CommandText = "INSERT INTO owner_detail(c_id, o_name, investment) values(@cid,'" + TextBox1.Text + "','" + TextBox2.Text + "')" cmd.ExecuteNonQuery() MsgBox("Data is Successfully Inserted! ") cnn.Close() Catch ex As Exception MsgBox("Can not open connection ! ") End Try