如何在一个过程中打开两个表
在一个过程中要打开两个表,我现在是用如下方法
Dim Conn, conn1 As New SqlConnection
Dim Comd, comd1 As SqlCommand
Dim strsql As String
Dim obj As New jbfx.pub
Dim Dtrd, dtrd1 As SqlDataReader
Conn.ConnectionString = obj.Conn_str
Conn.Open()
Conn1.ConnectionString = obj.Conn_str
Conn1.Open()
strsql = "select * from bm where s_sjbm= '00000000 ' "
Comd = New SqlCommand(Trim(strsql), Conn)
Dtrd = Comd.ExecuteReader()
ListBox1.Items.Clear()
Do While Dtrd.Read
ListBox1.Items.Add(New ListItem(Dtrd( "s_bm "), Dtrd( "s_bmid ")))
Loop
strsql = "select * from zdjg where id= " & Request( "sjgid ")
comd1 = New SqlCommand(strsql, conn1)
dtrd1 = comd1.ExecuteReader()
TextBox1.Text = i
'TextBox2.Text = dtrd1( "i_yj ")
conn1.Close()
Conn.Close()
可是如果我让 'TextBox2.Text = dtrd1( "i_yj ")一执行就报错不知为什么.
另SqlConnection是否可以只做一个,我开始也是做一个SqlConnection,但执行dtrd1 = comd1.ExecuteReader()就报错,不知为什么.
------解决方案--------------------可是如果我让 'TextBox2.Text = dtrd1( "i_yj ")一执行就报错不知为什么.
================
1.
dtrd1 = comd1.