SQL语句的问题 , 多学点SQL语句就可以了
解决方案 »
- vb 读取txt文本 难点是G90 G01怎么分别读取后面的数值。
- VB中的不明代码
- VB 如何按要求选中checkbox
- 求在VB6中制作标准DLL的步骤方法。我想在VB6中将一些现有的函数制作成DLL,然后在C#中调用这个DLL中的函数。
- access数据库数据按时间间隔筛选问题,求解决办法 ACCESS数据库字段 “温度”是每隔3秒钟存一个数据,查询的只要按照时间间隔选择其中的一部分即可,即 3秒、30秒、1分钟 。。。等几个时间间隔把数据筛选出来,请问怎么处理?
- 送分,能解决文件打开关联的立即送100分。网上等!
- 终于看到雪了
- 邮件发送问题 各位帮忙 急!!!!!!!!!!!!!!
- 用ado能取到oracle中的long类型字段的内容吗?
- 用SELECT * FORM语句查询后如何反馈找到的信息!请各位高手指教!
- 一个小问题:整型数除以整型数结果赋植给浮点数结果不准确
- 急需关于mschart+access的程序例子。100分(另有高分相送)
查出记录后,在SQL语句中排序是:order by 字段名
在程序中排序是rs.sort="字段名"
adodc1.recordersource="select * from bb "
datagrid1.datasource=adodc1
等等做了一系列操作,我现在想在同一程序中把recordersource属性换成表,不是用SQL语句了,我该怎么做?
刚开始我是用语句:adodc1.connectionsting="dsn=aaa"
adodc1.recordersource="select * from bb "
datagrid1.datasource=adodc1
等等做了一系列操作,我现在想在同一程序中把recordersource属性换成表,不是用SQL语句了,我该怎么做?
adodc1.recordersource="select * from bb "
datagrid1.datasource=adodc1
以上是你的原句,
换成不同的表,只用换sql语句。可以这样写
adodc1.connectionsting="dsn=aaa"
adodc1.recordersource="select * from 表名"
adodc1.Refresh
DataGrid1.ClearFields
DataGrid1.ReBind
'''''
刚开始我是用语句:adodc1.connectionsting="dsn=aaa"
adodc1.recordersource="select * from bb "
datagrid1.datasource=adodc1
等等做了一系列操作,我现在想在同一程序中把recordersource属性换成表,不是用SQL语句了,我该怎么做?
'''''
adodc控件的commandtype属性.鉴别是SQL语句还是表名,把acodc1.commandtype
改一下就行了
Str = "select * from sport where zb='" & Option1(Indx).Caption & "'"
Adodc1.ConnectionString = "dsn=sport1"
Adodc1.RecordSource = Str
Set DataGrid1.DataSource = Adodc1
While Not Adodc1.Recordset.EOF
If Adodc1.Recordset.Fields("dw").Value = "体育系" Then
stucj(0) = stucj(0) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "化学系" Then
stucj(1) = stucj(1) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "物理系" Then
stucj(2) = stucj(2) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "中文系" Then
stucj(3) = stucj(3) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "社科系" Then
stucj(4) = stucj(4) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "数学系" Then
stucj(5) = stucj(5) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "外语系" Then
stucj(6) = stucj(6) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "计算机系" Then
stucj(7) = stucj(7) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "工商法律系" Then
stucj(8) = stucj(8) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "初等教育系" Then
stucj(9) = stucj(9) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "艺术与学前教育系" Then
stucj(10) = stucj(10) + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "机关" Then
Stujgboy = Stujgboy + Adodc1.Recordset.Fields("df").Value
End If
If Adodc1.Recordset.Fields("dw").Value = "后勤" Then
Stuhqboy = Stuhqboy + Adodc1.Recordset.Fields("df").Value
End If
Adodc1.Recordset.MoveNext
Wend
'如下语句我想更改RECORDSOURC属性,使上面计算出的值存到另外一个表zf0中
Adodc1.ConnectionString = "dsn=sport1"
Adodc1.RecordSource = "select * from zf0"
DataGrid1.ClearFields
DataGrid1.ReBind
Set DataGrid1.DataSource = Adodc1
For i = 0 To 10
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("dw") = "体育系"
Adodc1.Recordset.Fields("cj") = stucj(i)
Adodc1.Recordset.MoveNext
Next
Adodc1.Refresh
End Sub
从运行错误代码中可以看出,所做的操作还是针对SPORT表,就是说RECORDERSOURCE 属性没有变,请高手指点。谢谢!!!