如图,想问一下,这个函数要怎编写 万分感谢!!

我有个数据库文件 想在初始化中读取 数据库文件如图,然后我有个PUblic sbwenduup(1to11),sbwendulow(1to11),sbtime2(1to11),sbtime3(1to11),sbdianliuup(1to11),sbdianliuups(1to11),sbalarm(1to11) as string
这些数值分别对应温度上限列,温度下限列,开机时间列,停机时间列。球磨机电流上限列,循环泵电流上限列,报警时间列。



DIEA
浏览 128回答 2
2回答

ITMISS

ADODC+DATAGRID+ACCESS大体如下,细节自己改:Private Sub Form_Load()With Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db1.mdb;Persist Security Info=False".CommandType = adCmdText.RecordSource = "select * from 表A".RefreshSet DataGrid1.DataSource = Adodc1For i = 1 To .Recordset.RecordCountsbwenduup(i) = .Recordset.Fields(0)sbwendulow(i) = .Recordset.Fields(1)sbtime2(i) = .Recordset.Fields(2)sbtime3(i) = .Recordset.Fields(3)sbdianliuup(i) = .Recordset.Fields(4)sbdianliuups(i) = .Recordset.Fields(5)sbalarm(i) = .Recordset.Fields(6).Recordset.MoveNextNextEnd WithEnd Sub

慕标5832272

Private Sub Form_Load()With Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db1.mdb;Persist Security Info=False" ‘连接数据库,C:\db1.mdb是数据库路径.CommandType = adCmdText.RecordSource = "select * from 表A" ‘对db1.mdb数据库执行的SQL语句.RefreshSet DataGrid1.DataSource = Adodc1For i = 1 To .Recordset.RecordCount ’循环,i 从 1 到 上面的查询语句查出的数据条数sbwenduup(i) = .Recordset.Fields(0) ‘Recordset.Fields(0) 表A第一列的数据sbwendulow(i) = .Recordset.Fields(1) ’同理sbtime2(i) = .Recordset.Fields(2)sbtime3(i) = .Recordset.Fields(3)sbdianliuup(i) = .Recordset.Fields(4)sbdianliuups(i) = .Recordset.Fields(5)sbalarm(i) = .Recordset.Fields(6).Recordset.MoveNext ‘移到下一组数据NextEnd WithEnd Sub
打开App,查看更多内容
随时随地看视频慕课网APP