| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 740 人关注过本帖
标题:[求助]客户端的txt文件导入到数据库
只看楼主 加入收藏
wrjk512
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-11-22
收藏
 问题点数:0 回复次数:2 
[求助]客户端的txt文件导入到数据库

小弟想把客户端的txt文件导入到数据库,txt格式如下:
0310100, 大白菜, 2.650, .350, .544, .400, .500, 14588.450,2007-01-29, 26929.900, 7934.69, 13474.88, 300;
0310104, 黄心菜, 3.620, .400, .757, .800, .637, 2568.200,2007-01-29, 5235.100, 1943.27, 3336.14, 93;
0310200, 青菜, .984, .500, .736, .500, .715, 448.600,2007-01-29, 1408.000, 330.16, 1006.72, 12;
0310201, 小白菜, 2.000, .300, .676, .300, .821, 10516.450,2007-01-29, 12388.450, 7113.02, 10167.72, 383;
0310400, 菠菜, 3.200, .600, 1.713, 1.600, 2.235, 5439.400,2007-01-29, 4993.500, 9314.98, 11160.09, 289;
0310500, 包菜, 2.905, .380, .581, .600, .587, 5063.000,2007-01-29, 10706.600, 2940.71, 6288.75, 125;
0310600, 花菜, 2.500, 1.500, 2.258, 2.400, 1.520, 59.000,2007-01-29, 1340.800, 133.24, 2037.50, 4;
0310900, 生菜, 2.400, 2.200, 2.382, 2.400, 3.608, 29.600,2007-01-29, 199.400, 70.52, 719.52, 5;
0311000, 莴笋, 5.580, .500, 1.120, .500, 1.154, 5666.900,2007-01-29, 11798.900, 6349.23, 13620.35, 175;
0311200, 芹菜, 5.470, .500, 1.094, .500, 1.010, 13446.000,2007-01-29, 17351.100, 14703.96, 17524.84, 518;
0311400, 香菜, 4.800, .523, 2.280, 2.200, 2.552, 4180.200,2007-01-29, 4312.400, 9531.39, 11004.96, 276;
0311500, 茼蒿, 2.400, 2.000, 2.141, 2.200, 2.259, 71.800,2007-01-29, 310.500, 153.72, 701.28, 11;
0312101, 大葱, 4.545, .400, 1.145, .800, 1.374, 2671.100,2007-01-29, 5721.500, 3057.85, 7860.81, 146;
0312102, 小葱, 4.000, .638, 2.908, .800, 2.771, 2991.200,2007-01-29, 3455.400, 8699.24, 9573.91, 287;
0312200, 洋葱, 2.700, 2.100, 2.224, 2.700, 2.166, 307.000,2007-01-29, 2892.000, 682.68, 6264.98, 6;
0312300, 蒜苗, 12.300, 1.000, 4.121, 2.800, 3.606, 232.600,2007-01-29, 1022.200, 958.46, 3686.17, 9;
0312500, 大蒜, 10.520, .800, 2.112, 1.700, 1.958, 14839.200,2007-01-29, 31893.700, 31339.91, 62450.92, 618;
0312700, 韭菜, 3.200, .440, 2.042, 1.200, 2.278, 1590.300,2007-01-29, 5572.100, 3247.96, 12694.15, 96;
0312800, 韭黄, 5.000, 2.900, 3.084, 4.000, 2.704, 1948.000,2007-01-29, 1157.100, 6007.98, 3128.57, 42;
0313300, 竹笋, 3.500, 3.500, 3.500, 3.500, 10.000, 12.000,2007-01-29, 45.800, 42.00, 458.00, 1;
0314400, 荠菜, 5.000, 3.000, 4.532, 5.000, 4.942, 38.000,2007-01-29, 113.800, 172.20, 562.36, 7;
0320101, 红椒, 1.800, 1.600, 1.638, 1.780, 1.197, 497.000,2007-01-29, 17722.300, 814.21, 21208.91, 6;
0320200, 青椒, 20.000, .832, 4.161, .832, 1.271, 462.500,2007-01-29, 4513.000, 1924.25, 5733.61, 13;
0320300, 茄子, 5.210, 1.200, 3.252, 1.200, 2.080, 87.600,2007-01-29, 839.600, 284.89, 1746.69, 4;
0320500, 西红柿, 8.905, .800, 1.867, 4.400, 2.209, 1275.200,2007-01-29, 4960.700, 2380.30, 10955.79, 22;
0322100, 黄瓜, 6.300, .456, 2.274, 2.400, 2.682, 1554.000,2007-01-29, 2832.600, 3533.11, 7598.24, 63;
0322200, 冬瓜, 4.610, .500, .922, .900, 1.087, 5507.300,2007-01-29, 15246.000, 5079.81, 16572.52, 170;
0323100, 南瓜, 5.215, 1.100, 1.781, 5.215, 1.902, 176.800,2007-01-29, 1882.900, 314.83, 3581.24, 8;
0330100, 萝卜, 2.675, .200, .546, .600, .588, 15573.200,2007-01-29, 21437.400, 8498.81, 12614.57, 574;
0330102, 白萝卜, .600, .300, .579, .600, .555, 1506.200,2007-01-29, 2266.000, 872.49, 1256.73, 60;
0330103,青头萝卜, .600, .400, .527, .520, .567, 1257.800,2007-01-29, 737.400, 663.26, 417.76, 26;
0330200, 胡萝卜, 1.200, .300, .628, .400, .767, 2691.000,2007-01-29, 7162.200, 1690.83, 5489.56, 44;
0340100, 土豆, 2.400, .294, 1.466, 1.000, 1.561, 1931.900,2007-01-29, 10264.200, 2833.12, 16017.47, 41;
0340200, 山药, 3.600, 3.600, 3.600, 3.600, 3.388, 15.600,2007-01-29, 1381.200, 56.16, 4679.08, 1;
0340300, 地瓜, 3.200, .840, 1.103, .900, 1.165, 113.800,2007-01-29, 365.000, 125.56, 425.13, 6;
0340500, 生姜, 1.700, 1.700, 1.700, 1.700, 1.797, 44.000,2007-01-29, 27.600, 74.80, 49.60, 2;
0350100, 莲藕, 18.000, 1.805, 5.667, 2.000, 1.479, 45.600,2007-01-29, 370.600, 258.40, 548.01, 4;
0350200, 茭白, 3.500, 1.250, 2.620, 1.250, .000, 27.600,2007-01-29, .000, 72.30, .00, 2;
0350400, 地粟, 1.250, 1.250, 1.250, 1.250, .000, 7.400,2007-01-29, .000, 9.25, .00, 1;
0360300, 蘑菇, 2.400, .260, 1.299, 2.000, 5.279, 31.400,2007-01-29, 1149.700, 40.80, 6069.66, 3;
0360400, 金针菇, 6.200, .503, 2.517, .503, 6.586, 99.000,2007-01-29, 435.500, 249.23, 2868.31, 6;
0360500, 草菇, 5.800, 5.800, 5.800, 5.800, .000, 7.800,2007-01-29, .000, 45.24, .00, 1;
0363100, 木耳, .100, .100, .100, .100, 8.280, 11.600,2007-01-29, 171.000, 1.16, 1415.88, 1;
0370300, 豆角, 9.000, .904, 2.472, 2.200, 3.841, 181.400,2007-01-29, 3776.200, 448.36, 14502.68, 12;
0370500, 蚕豆, 10.857, 5.429, 7.334, 7.500, .000, 1067.200,2007-01-29, .000, 7826.50, .00, 5;
0414900, 菇娘, 1.200, 1.200, 1.200, 1.200, 1.040, 63.400,2007-01-29, 62.400, 76.08, 64.90, 1;
0390001, 生瓜, 4.550, .402, 1.982, 1.000, 2.243, 708.200,2007-01-29, 492.900, 1403.56, 1105.66, 18;
0340201, 山芋, 3.600, .266, 1.328, 1.000, 1.413, 12324.300,2007-01-29, 22650.000, 16365.63, 32003.50, 166;
0340202, 马蹄, 8.900, 1.480, 7.400, 1.480, 2.753, 64.200,2007-01-29, 372.400, 475.06, 1025.29, 2;


用逗号隔开的是同一行的内容,用分号隔开的是需要换行的内容。

搜索更多相关主题的帖子: 数据库 txt 客户 文件 
2007-01-31 10:10
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
收藏
得分:0 
先读后写,用正则或者StreamTokenizer

可惜不是你,陪我到最后
2007-01-31 10:19
angeloc
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:36
帖 子:1353
专家分:0
注 册:2006-11-21
收藏
得分:0 

你的思路很明确,把得到内容插入库就行了.不过在此之前你可能要把文件上传到服务器上,获得信息后再把文件从服务器上删除.


老牛明知夕阳晚,不用扬鞭自奋蹄; Angelo\'s BLOG
2007-01-31 10:20
快速回复:[求助]客户端的txt文件导入到数据库
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.052725 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved