VB.NET 2003
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在system.data.dll中。其他信息:系统错误。PrivateSub...
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。
其他信息: 系统错误。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myconn As New SqlConnection("Initial Catalog=school;Data Source=(Local);" & "Integrated Security=SSPI;")
Dim sql As String = "Select * From T_Student Where BookCode='" & TextBox3.Text & "'"
Dim mycmd As New SqlCommand(sql, myconn)
Dim myread As SqlDataReader
myconn.Open()
myread = mycmd.ExecuteReader
myread.Read()
TextBox2.Text = myread.Item(0)
TextBox1.Text = myread.Item(1)
求帮助 VB.NET 2003 展开
其他信息: 系统错误。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myconn As New SqlConnection("Initial Catalog=school;Data Source=(Local);" & "Integrated Security=SSPI;")
Dim sql As String = "Select * From T_Student Where BookCode='" & TextBox3.Text & "'"
Dim mycmd As New SqlCommand(sql, myconn)
Dim myread As SqlDataReader
myconn.Open()
myread = mycmd.ExecuteReader
myread.Read()
TextBox2.Text = myread.Item(0)
TextBox1.Text = myread.Item(1)
求帮助 VB.NET 2003 展开
4个回答
展开全部
顺序不对吧,先查询再打开数据库?
Dim myconn As New SqlConnection("Initial Catalog=school;Data Source=(Local);" & "Integrated Security=SSPI;")
myconn.Open() '先打开数据库
Dim sql As String = "Select * From T_Student Where BookCode='" & TextBox3.Text & "'"
Dim mycmd As New SqlCommand(sql, myconn) '再查询
Dim myread As SqlDataReader
Dim myconn As New SqlConnection("Initial Catalog=school;Data Source=(Local);" & "Integrated Security=SSPI;")
myconn.Open() '先打开数据库
Dim sql As String = "Select * From T_Student Where BookCode='" & TextBox3.Text & "'"
Dim mycmd As New SqlCommand(sql, myconn) '再查询
Dim myread As SqlDataReader
展开全部
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myconn As New SqlConnection("Initial Catalog=school;Data Source=(Local);" & "Integrated Security=SSPI;")
myconn.Open()
Dim sql As String = "Select * From T_Student Where BookCode='" & TextBox3.Text & "'"
Dim mycmd As New SqlCommand(sql, myconn)
Dim myread As SqlDataReader
myread = mycmd.ExecuteReader
myread.Read()
TextBox2.Text = myread.Item(0)
TextBox1.Text = myread.Item(1)
Dim myconn As New SqlConnection("Initial Catalog=school;Data Source=(Local);" & "Integrated Security=SSPI;")
myconn.Open()
Dim sql As String = "Select * From T_Student Where BookCode='" & TextBox3.Text & "'"
Dim mycmd As New SqlCommand(sql, myconn)
Dim myread As SqlDataReader
myread = mycmd.ExecuteReader
myread.Read()
TextBox2.Text = myread.Item(0)
TextBox1.Text = myread.Item(1)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
建议你用TRY抓一下SQL报错的详细信息就知道了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询