怎么将搜索出的模糊匹配数据输出到DataGrid
如何将搜索出的模糊匹配数据输出到DataGrid
如何将搜索出的数据输出到DataGrid
比如
text1.text = "% "
text2.text = "% "
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\db2.mdb;Persist Security Info=False "
res3.CursorLocation = adUseClient
res3.Open "select userid from user where userid =
' " + Text1.Text + " 'and username = ' "+ Text1.Text + " ' ",cn, adOpenStatic, adLockOptimistic
Set DataGrid2.DataSource = res3
为何我的DataGrid2中不出现数据只出现字段阿
------解决方案--------------------
两种情况
1、你的sql语句执行一下,估计没有数据
2、试试我的办法
你试试吧,好用的
记得要引用ado
你只需要在工程/引用 miscrosoft Activex data objects 2.x library 就可以了
Dim Db As Connection
Dim WithEvents adoPrimaryRS As Recordset '数据库连接对象
Private Sub Command1_Click()
strsql= "select 字段 from 表 where 你的条件 "
Set Db = New Connection
Db.CursorLocation = adUseClient
'下面的连接数据字符串你要修改一下
Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\计划管理系统.mdb;Persist Security Info=False "
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open strsql, Db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = adoPrimaryRS
end sub
如何将搜索出的数据输出到DataGrid
比如
text1.text = "% "
text2.text = "% "
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\db2.mdb;Persist Security Info=False "
res3.CursorLocation = adUseClient
res3.Open "select userid from user where userid =
' " + Text1.Text + " 'and username = ' "+ Text1.Text + " ' ",cn, adOpenStatic, adLockOptimistic
Set DataGrid2.DataSource = res3
为何我的DataGrid2中不出现数据只出现字段阿
------解决方案--------------------
两种情况
1、你的sql语句执行一下,估计没有数据
2、试试我的办法
你试试吧,好用的
记得要引用ado
你只需要在工程/引用 miscrosoft Activex data objects 2.x library 就可以了
Dim Db As Connection
Dim WithEvents adoPrimaryRS As Recordset '数据库连接对象
Private Sub Command1_Click()
strsql= "select 字段 from 表 where 你的条件 "
Set Db = New Connection
Db.CursorLocation = adUseClient
'下面的连接数据字符串你要修改一下
Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\计划管理系统.mdb;Persist Security Info=False "
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open strsql, Db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = adoPrimaryRS
end sub