当前位置:编程学习 > VB >>

VB+access 怎样实现这样的结果?急!急!

我想实现下面的结果在datagrid中显示,请写出代码,谢谢!
Date Series            AssyPN          Failure Description
201012-20 NEO           750-031088 hsl2fail
201012-20 NEO           750-031088 hsl2fail
201012-20 NEO           750-031088 hsl2fail
201012-20 AgentSimth  750-031088       hsl2fail
201012-21 AgentSimth  750-031088 hsl2fail
201012-21 NEO           750-031088 boot fail
201012-21 NEO           750-031088 boot fail
201012-21 NEO           750-031088 boot fail
201012-21 NEO           750-031088 boot fail
201012-21 AgentSimth  750-031088 boot fail
201012-21 AgentSimth  750-031088 boot fail
201012-21 AgentSimth  750-031088 boot fail
201012-21 AgentSimth  750-031088 diag luchip fail
201012-22 AgentSimth  750-031088 diag luchip fail
201012-22 AgentSimth  750-031088 diag luchip fail
201012-22 AgentSimth  750-031088 diag luchip fail
201012-22 NEO           750-031088 diag luchip fail
201012-22 NEO           750-031088 diag luchip fail
201012-22 NEO           750-031088 diag luchip fail
201012-22 NEO           750-031088 diag luchip fail
201012-23 NEO                750-031088 diag luchip fail
201012-23 NEO           750-031088 diag luchip fail
201012-23 AgentSimth  750-031088 ram_bist all stress
201012-23 AgentSimth  750-031088 ram_bist all stress
201012-23 AgentSimth  750-031088 ram_bist all stress
201012-23 AgentSimth  750-031088 ram_bist all stress
201012-23 NEO           750-031088 ram_bist all stress
201012-23 NEO           750-031088 ram_bist all stress
201012-23 NEO           750-031088 ram_bist all stress
201012-23 NEO           750-031088 ram_bist all stress

TopIssue Failure Description Count
Top 1 diag luchip fail          10
Top 2 ram_bist all stress 8
Top 3 hsl2fail                   6

VB控件如何使用的问题,与 ACCESS 关系不大
select top 3 from (
select [Failure Description],count(*) as [Count]
from table1
group by 2 desc
)
'Ctrl+t找Microsoft DataGrid Control.... 
'菜单"工程"->"引用" 找 Microsoft ActiveX Data Object.... 

Dim cn As New ADODB.Connection
    Dim rst As New ADODB.Recordset
    Dim SqlStr As String
    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Mode=ReadWrite;Persist Security 

Info=False;Jet OLEDB:Database Password=111"
    SqlStr = "Select Date,Series,AssyPN,Failure,Description From 某个表"
    rst.CursorLocation = adUseClient
    rst.Open SqlStr, cn, adOpenDynamic, adLockOptimistic, adCmdText '打开记录集
Set DataGrid1.DataSource = rst '给DataGrid修改数据源
补充:VB ,  数据库(包含打印,安装,报表)
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,