您的位置:程序门 -> .net技术 -> vb.net



vb.net如何将sql数据倒入到excel表格中


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vb.net如何将sql数据倒入到excel表格中
发表于:2007-06-08 13:22:52 楼主
新手上路,望高手指点!
发表于:2007-06-08 15:22:481楼 得分:0
你在vs.net的msdn中找excel.application   ,看相关资料
发表于:2007-06-08 15:24:512楼 得分:0
这个都回答了n遍了吧
http://blog.csdn.net/zzy1254/archive/2007/05/21/1618959.aspx
发表于:2007-06-08 15:58:133楼 得分:0
用sql
发表于:2007-06-08 19:44:024楼 得分:0
我主要是想知道如何把dataset数据表写入axspreadsheet中,就像写入datagridview一样,但我整半天没整明白?望指点!!!
发表于:2007-06-08 20:13:405楼 得分:0
我也在学习诶,希望大家指点
发表于:2007-07-12 15:43:116楼 得分:0
和sql   server操作类似的:
dim   conn   as   new   data.oledb.oledbconnection( "provider=microsoft.jet.oledb.4.0;data   source=c:\documents   and   settings\weichen\桌面\新建   microsoft   excel   工作表.xls;extended   properties=excel   8.0; ")
                        conn.open()
                        dim   comm   as   new   oledb.oledbcommand
                        comm.commandtext   =   "insert   into   [sheet1$]   values( ' ') "
                        comm.commandtype   =   commandtype.text
                        comm.connection   =   conn
                        comm.EXECutenonquery()
更简单的:
                        dim   mytext   as   string= " "
                        dim   myc   as   integer   =   ds.tables(0).columns.count   -   1
                        dim   myr   as   integer   =   ds.tables(0).rows.count   -   1
                        dim   i   as   integer
                        dim   j   as   integer

                        for   j   =   0   to   myc
                                mytext   +=   ds.tables(0).columns(j).columnname   &   chr(9)
                        next
                        mytext   +=   chr(10)
                        for   i   =   0   to   myr
                                for   j   =   0   to   myc
                                          mytext   +=   ds.tables(0).rows(i).item(j).tostring   &   chr(9)
                                next
                                mytext   +=   chr(10)
                        next
                        dim   sw   as   new   streamwriter( "excel文件地址 ".text,   true,   system.text.encoding.getencoding( "gb2312 "))
                        sw.write(mytext)
                        sw.close()
                        sw.dispose()
发表于:2007-07-19 22:24:147楼 得分:0
excel.application


快速检索

最新资讯
热门点击