sql = "Select case when date ='' then '0'else CONVERT(varchar(100), date, 101) end as date,case when ad ='' then '0'else CONVERT(varchar(100), ad, 101) end as ad,event1,type1,code from EventData where ip='" + UserIP + "' order by code,event1"

            Dim table As DataTable = gData.GetDataTable(sql, SqlConnect) '將所有的查詢結果放入臨時表中,在查詢臨時表內容
Dim count = table.Rows.Count If count = Then
MessageBox.Show("no data.")
Exit Sub
End If Dim sw As StreamWriter = File.CreateText(TextBox1.Text & "\" & "Events.csv") '在桌面創建文件Events.csv Dim c As String = ""
For i As Integer = To count
If i = Then 'header
sw.WriteLine("E.CODE,E.TYPE,E.EVENT,E.AD,E.DONE") '標題
Else 'data
For j As Integer = To '一共5列
If j = Then
c = table.Rows(i - ).Item(j)
Else
c = table.Rows(i - ).Item(j) & "," & c '對字段進行拼接
End If
Next
sw.WriteLine(c)
c = "" '將C清空
End If
Next sw.Flush()
sw.Close() '新建文件將原有的內容覆蓋

最新文章

  1. 调用SAP函数创建寄售退货订单的时候报错:业务对象 BUS2032 是销售订单,销售凭证类别 H 是退货。
  2. python 2.7 简单模拟登陆网站
  3. EmguCV 轮廓匹配
  4. SSH基础(2)
  5. oracle自定义job名字,job调度
  6. WPF 之 WPF应用程序事件
  7. VmodCAM图像采集 VGA显示
  8. HDU 5762 Teacher Bo
  9. EF查询生成的SQL
  10. struts2标签库使用小结
  11. c#枚举值增加特性说明
  12. s:textarea 标签不能改变大小的解决方案
  13. spring boot 遇到 supported setting property http://xml.org/sax/properties/lexical-handler
  14. 01-java技术体系基础
  15. MySQL 笔记整理(4) --深入浅出索引(上)
  16. #2019-2020-4 《Java 程序设计》第八周总结
  17. 【BZOJ3379】[Usaco2004 Open]Turning in Homework 交作业
  18. python 数据类型 之 字典
  19. 为sharepoint的内部页面添加后台代码
  20. 让APK 成功在 Windows 运行并可以设置本地文件

热门文章

  1. 51Nod:独木舟问题(贪心)
  2. 差分约束+spfa【模板】
  3. dbt macro 说明
  4. Codeforces Round #243 (Div. 2)——Sereja and Swaps
  5. mime type 类型名字应该用多长的字段?
  6. tomcat源码阅读之单点登录
  7. putty SSH tunnel function
  8. 【转】每天一个linux命令(5):rm 命令
  9. js 各种循环遍历
  10. java中String对象的存储位置