如何将文本文件读入到数据库中?(文本文件有格式的)

tteagle 2003-01-11 09:56:08
如何将文本文件读入到数据库中?(文本文件有格式的)
...全文
19 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tteagle 2003-01-13
  • 打赏
  • 举报
回复
谢谢各位,我自己搞定了,我用dts来做,然后再程序里调用dts
saucer(思归, MS .NET MVP)的方法有点麻烦:)
saucer 2003-01-11
  • 打赏
  • 举报
回复
0. create an SqlDataAdapter + DataSet + SqlCommandBuilder
1. read each line
2. split the line into an array of strings
3. add a new DataRow to your DataTable, fill in the columns with values in step 2
4. repeat 1-3 steps until no line left
5. call YourSqlDataAdapter.Update(YourDataSet)
tteagle 2003-01-11
  • 打赏
  • 举报
回复
数据库是sql server,不过我想在程序里转换数据,用c#写
saucer 2003-01-11
  • 打赏
  • 举报
回复
what database are you using? if you are using SQL Server, try bcp
tteagle 2003-01-11
  • 打赏
  • 举报
回复
更正:
如何将文本文件里的数据读入到数据库中?(文本文件有格式的)例如:
12,abc,1234
44,das,123412
55,ewe,24123

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧