vb+access查询问题,想要将查询内容显示在text中,但是不知道具体怎么写语法
PrivateSubCommand1_Click()DimRsAsNewRecordsetconn.ConnectionString="Provider=Microsof...
Private Sub Command1_Click()
Dim Rs As New Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\data.mdb"
conn.Open
Text4.Text = "select 欠款时间 from 用户资料单 where 名称='" & Trim(Text1.Text) & "'"
Text5.Text = "select 库存量 from 库存 where 零件代码='" & Trim(Text2.Text) & "'"
conn.Close
End Sub
不知道怎么写,还请大神帮忙!谢谢 展开
Dim Rs As New Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\data.mdb"
conn.Open
Text4.Text = "select 欠款时间 from 用户资料单 where 名称='" & Trim(Text1.Text) & "'"
Text5.Text = "select 库存量 from 库存 where 零件代码='" & Trim(Text2.Text) & "'"
conn.Close
End Sub
不知道怎么写,还请大神帮忙!谢谢 展开
2个回答
展开全部
Private Sub Command1_Click()
Dim Rs As New Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\data.mdb"
conn.Open
rs.open "select 欠款时间 from 用户资料单 where 名称='" & Trim(Text1.Text) & "'",conn
Text4.Text =rs.fields("欠款时间")
rs.close
rs.open "select 库存量 from 库存 where 零件代码='" & Trim(Text2.Text) & "'",conn
Text5.Text = rs.fields("库存量")
rs.close
set rs=nothing
conn.Close
set conn=nothing
End Sub
展开全部
conn.open 后面改写:
q= "select 欠款时间 from 用户资料单 where 名称='" & Trim(Text1.Text) & "'"
conn.Open q
text4.text=conn.Fields("欠款时间")
conn.close
q= "select 库存量 from 库存 where 零件代码='" & Trim(Text2.Text) & "'"
conn.Open q
text5.text=conn.Fields("库存量")
conn.close
q= "select 欠款时间 from 用户资料单 where 名称='" & Trim(Text1.Text) & "'"
conn.Open q
text4.text=conn.Fields("欠款时间")
conn.close
q= "select 库存量 from 库存 where 零件代码='" & Trim(Text2.Text) & "'"
conn.Open q
text5.text=conn.Fields("库存量")
conn.close
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询