追忆......
曾几何时我也是快乐的.
登录
注册
全站
当前博客
空间
博客
好友
相册
留言
用户操作
[即时聊天]
[发私信]
[加为好友]
忆
ID:ititjt
共
4449
次访问,排名
19395
好友
1
人,关注者
1
人
ititjt的文章
原创 16 篇
翻译 0 篇
转载 3 篇
评论 2 篇
最近评论
ititjt:
写入注册表的文件录径的\需要转义.
lovepp0207:
你这都快成技术论坛了!
文章分类
.NET 技术
(RSS)
JAVA 技术
(RSS)
VB 技术
(RSS)
Windows 相关
(RSS)
环境搭建
(RSS)
其它 技术相关
(RSS)
数据库相关
(RSS)
娱乐休闲
(RSS)
收藏
技术
相册
海之韵-小海豹
.NET 技术
.NET-UML软件工程组织
Enterprise Library3.0 体验(1):集成VS2005的配置工具和配置区加密支持
宝航发来的地址01
blog 集
姜哥的网络信息记录
张丽丽的个人空间
昊的博客
欣欣的QQ空间
蝈的QQ空间
Java 技术
JAVA JSF1.2 的新特性
技术论坛 SUN社区
翻译
google翻译
翻译 excite (中,日,英)
翻译 爱词霸
休闲
S3国际服地图检索网
休闲 E都市 地图
休闲 三维立体画欣赏
休闲 死神 动画全集 在线观看
听网论坛
在线新华字典
地图接口 电子地图
地图频道接口(MapOne API)_使用方法2
存档
2007年09月(4)
2007年08月(1)
2007年07月(1)
2007年06月(1)
2007年05月(11)
软件项目交易
订阅我的博客
JAVA中CSV操作(导出和导入)
收藏
新一篇: 数据库连接字符串
|
旧一篇: VB中导出成生CSV文件
import
java.io.
*
;
public
class
csvbean
...
{
public
static
void
main(String[] args)
...
{
try
...
{
File file
=
new
File(
"
C:/name.csv
"
);
FileOutputStream out
=
new
FileOutputStream(file);
OutputStreamWriter osw
=
new
OutputStreamWriter(out);
BufferedWriter bw
=
new
BufferedWriter(osw);
//
insert data
bw.write(
"
aa
"
);
bw.write(
"
,
"
);
bw.write(
"
bb
"
);
bw.write(
"
,
"
);
bw.write(
"
cc
"
);
bw.write(
"
"
) ;
//
close
bw.close();
osw.close();
out.close();
}
catch
(Exception e)
...
{
e.printStackTrace() ;
}
}
}
/** */
/**
***********************************************************************************
*/
//
需要包: csvjdbc-r0-10.zip 536.81K
import
java.sql.
*
;
public
class
cvsbean
...
{
public
static
void
main(String[] args)
...
{
try
...
{
//
load the driver into memory
Class.forName(
"
org.relique.jdbc.csv.CsvDriver
"
);
//
create a connection. The first command line parameter is assumed to
//
be the directory in which the .csv files are held
Connection conn
=
DriverManager.getConnection(
"
jdbc:relique:csv:d:\
"
);
//
最后是文件路径
//
create a Statement object to execute the query with
Statement stmt
=
conn.createStatement();
String ssss
=
"
20060707171747
"
;
//
20060707171747是文件名
//
Select the ID and NAME columns from sample.csv
ResultSet results
=
stmt.executeQuery(
"
select * from
"
+
ssss);
//
dump out the results
while
(results.next())
...
{
System.out.println(
"
hh=
"
+
results.getString(
1
)
+
"
jj=
"
+
results.getString(
1
));
}
//
clean up
results.close();
stmt.close();
conn.close();
}
catch
(Exception e)
...
{
//
System.out.println("Oops-> " + e);
//
System.out.println(e.getMessage()) ;
e.printStackTrace();
}
}
}
发表于 @
2007年05月10日 10:45:00
|
评论(
loading...
)
|
编辑
新一篇: 数据库连接字符串
|
旧一篇: VB中导出成生CSV文件
评论:没有评论。
发表评论
姓 名:
主 页:
校验码:
看不清,换一张
当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击
登录