求vb小程序设计

来源:百度知道 编辑:UC知道 时间:2024/06/28 03:17:48
我弄个小程序 有一个输入框(输入要查询数据的依据)一个查询键
在输入窗口输入07010203这样的数 然后按查询键 按查询键后执行 sql语句 帮帮忙 急用 我的qq403867997

Set Cnn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.recordset")

Dim strSql As String
Dim strCnn As String

strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=SY3200.mdb "

Cnn.Open strCnn

strSql = "select * from 表1 where 从机号=" & Form1.Text1.Text

rs.Open strSql, Cnn, 1, 3

如果不懂 留个邮箱 我发个例子给你

dim conn= new ADODB.Connection
dim rs = new ADODB.Recordset
Dim strCnn As String
Dim strSql As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Test.mdb" & ";Persist Security Info=False "
strsql = "select * from tableName Where ID ='" & textBox1.text &"'"
conn.Open strConn
rs.Open strsql,conn,adOpenDynamic, adLockOptimistic

'楼上是ASP里的代码,这个是VB的 看你需要了