急!datagrid控件
datagrid 控件什么也显示不出来,用的Access数据库Dim cn As New adodb.Connection
Dim rs As New adodb.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:aa\KFGL.MDB;Persist Security Info=False"
'cnn.Open
请问怎么样,才能显示出来数据,不用Adodc控件的话。
谢谢了。 --------------------编程问答--------------------
Private Sub Form_Load()--------------------编程问答-------------------- 好的,我试试看行不 --------------------编程问答-------------------- 接分先! --------------------编程问答-------------------- 有点难度哦 --------------------编程问答-------------------- 楼上的正解。
Private Sub Form_Load()
Dim cn As New ADODB.Connection '定义数据库的连接存放数据和代码
Dim rs As New ADODB.Recordset
Dim sql As String
sql = "select * from jishijilu where car_bm like 'DF160%'" '左句按你实际的结构化查询语句写
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:aa\KFGL.MDB;Persist Security Info=False"
cn.Open
rs.CursorLocation = adUseClient
rs.Open sql, cn, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = rs
End Sub
http://topic.csdn.net/u/20080421/15/54b1de89-e1aa-4926-bd85-66888282d229.html
补充:VB , 数据库(包含打印,安装,报表)