码迷,mamicode.com
首页 > 其他好文 > 详细

0716

时间:2014-10-09 14:21:13      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:http   io   os   ar   for   sp   div   2014   art   

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
CREATE TABLE `calldetails` (
    `Id` INT(10) NOT NULL AUTO_INCREMENT,
    `ServiceType` VARCHAR(16) NULL DEFAULT ‘业务类型‘,
    `StartTime` DATE NULL DEFAULT NULL,
    `TimeOut` INT(11) NULL DEFAULT NULL,
    `CallType` VARCHAR(16) NULL DEFAULT NULL,
    `CallNum` CHAR(11) NULL DEFAULT NULL,
    `CallAddress` CHAR(5) NULL DEFAULT NULL,
    `SessionType` CHAR(4) NULL DEFAULT NULL,
    `BaseAndRoam` FLOAT NULL DEFAULT ‘0.0‘,
    `LongDistance` FLOAT NULL DEFAULT ‘0.0‘,
    PRIMARY KEY (`Id`)
)
COMMENT=‘详情表‘
COLLATE=‘utf8_general_ci‘
ENGINE=InnoDB;

?

1
INSERT INTO calldetails(StartTime,TimeOut,CallType,CallNum,CallAddress,SessionType,BaseAndRoam) VALUES(‘2014-02-01 09:21:21‘,23,‘被叫‘,15517834128,‘U0371‘,‘国内通话‘,‘0.0‘)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Call
    {
        public int Id { get; set; }
        public string ServcieType { get; set; }
        public DateTime StartTime { get; set; }
        public int TimeOut { get; set; }
        public string   CallType { get; set; }
        public string CallNum { get; set; }
        public string CallAddress { get; set; }
        public string SessionType { get; set; }
        public string BaseAndRoam { get; set; }
        public string LongDistance { get; set; }
        public string SubTotal { get; set; }
    }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
 
namespace OutputExcel
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void btnReader_Click(object sender, EventArgs e)
        {
            using (FileStream fs = File.OpenRead("201402.xls"))
            {
                //IWorkbook wk = new XSSFWorkbook(fs);
                IWorkbook wk = new HSSFWorkbook(fs);
                for (int i = 0; i < wk.NumberOfSheets; i++)
                {
                    ISheet sheet = wk.GetSheetAt(i);
                    Console.WriteLine("============{0}==Start============", sheet.SheetName);
                    for (int j = 0; j <= sheet.LastRowNum; j++)
                    {
                        IRow row = sheet.GetRow(j);
                        for (int k = 0; k < row.LastCellNum; k++)
                        {
                            ICell cell = row.GetCell(k);
                            if (cell.ToString().Contains("分"))
                            {
                                string[] time = cell.ToString().Replace("秒", " ").Split(‘分‘);
                                int totalTime = int.Parse(time[0]) * 60 + int.Parse(time[1]);
                            }
                        }
                    }
                    Console.WriteLine("============{0}==End==============", sheet.SheetName);
                }
            }
        }
 
        private void btnWriteExcel_Click(object sender, EventArgs e)
        {
 
            //IWorkbook wk = new HSSFWorkbook(); //读取03的xls
            IWorkbook wk = new XSSFWorkbook();   //读取07之后xlsx
            ISheet sheet = wk.CreateSheet("A1");
 
            IRow row1 = sheet.CreateRow(0);
            for (int i = 0; i < 10; i++)
            {
                row1.CreateCell(i).SetCellValue("create" + i);
            }
            IRow row2 = sheet.CreateRow(1);
            for (int i = 0; i < 8; i++)
            {
                row2.CreateCell(i).SetCellValue("delete" + i);
            }
 
            using (FileStream fs = File.OpenWrite("1213.xlsx"))
            {
                wk.Write(fs);
                MessageBox.Show("ok");
            }
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
 
        }
    }
}






0716

标签:http   io   os   ar   for   sp   div   2014   art   

原文地址:http://www.cnblogs.com/qq0827/p/0313fcf72ca38491c2dd0a49300af932.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!