ExecuteReader: Connection 属性尚未初始化----vb编写的跳出这个错误,怎么解决啊 5
PublicconAsNewSqlConnection("server=.;integratedsecurity=sspi;database=tsglxt")Dimcom...
Public con As New SqlConnection("server=.;integrated security=sspi;database=tsglxt")
Dim com As New SqlCommand
dim str1 as string = "select d_jszb.xm d_jszb.bh d_jszb.szbj form d_jszb where d_tsmx.jszkh=d_jszb.bh and d_ccdj.tsch=d_tsmd.tsch and " & text & "=d_tsmx.tstxmh "
com.CommandText = str1
Dim MyReader As SqlDataReader = com.ExecuteReader()
If MyReader.HasRows Then
While MyReader.Read
TextBox2.Text = MyReader("d_jszb.xm")
TextBox3.Text = MyReader("d_jszb.bh")
TextBox4.Text = MyReader("d_jszb.szbj")
End While
End If
我的意思是查询出东西,然后某些字段在textbox控件里显示出来~ 展开
Dim com As New SqlCommand
dim str1 as string = "select d_jszb.xm d_jszb.bh d_jszb.szbj form d_jszb where d_tsmx.jszkh=d_jszb.bh and d_ccdj.tsch=d_tsmd.tsch and " & text & "=d_tsmx.tstxmh "
com.CommandText = str1
Dim MyReader As SqlDataReader = com.ExecuteReader()
If MyReader.HasRows Then
While MyReader.Read
TextBox2.Text = MyReader("d_jszb.xm")
TextBox3.Text = MyReader("d_jszb.bh")
TextBox4.Text = MyReader("d_jszb.szbj")
End While
End If
我的意思是查询出东西,然后某些字段在textbox控件里显示出来~ 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询