急!怎样用VB调用access数据库进行自定义排序,比如用学生学号进行排序,请给出一段代码
2个回答
展开全部
如果是程序里,你可以先查询出数据,然后放到数组里
select date from table order by date Desc
RS.open csql,conn,1,1
strD = ""
n = 0
IF RS.recordcount 0 Then
do while not RS.EOF
IF strD RS(0) Then
n =n+1
redim preserve ArrDate(n)
arrDate(n) = Year(RS(0)) "-" Month(RS(0))
End IF
RS.MoveNext
Loop
End IF
RS.close
数组arrDate就是你想要的格式
select date from table order by date Desc
RS.open csql,conn,1,1
strD = ""
n = 0
IF RS.recordcount 0 Then
do while not RS.EOF
IF strD RS(0) Then
n =n+1
redim preserve ArrDate(n)
arrDate(n) = Year(RS(0)) "-" Month(RS(0))
End IF
RS.MoveNext
Loop
End IF
RS.close
数组arrDate就是你想要的格式
展开全部
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sqls As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=app.path &"\1.mdb";Jet OLEDB:,1,3
conn.Open
sqls = "select * from student order by s_id"
rs.Open sqls, conn
Dim rs As ADODB.Recordset
Dim sqls As String
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=app.path &"\1.mdb";Jet OLEDB:,1,3
conn.Open
sqls = "select * from student order by s_id"
rs.Open sqls, conn
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询