惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - Snow*Cao

request 生命周期及参数信息 vs2010 调试快捷键 温故而知新:封装、继承、多态 海量的jQuery插件帖,很经典 委托事件的理解(转载) 常用JQuery插件整理 关于数据挖掘的详细介绍的一些网址 DropDownList 默认展示从数据库查询的值 Python 开发环境搭建 WCF优秀资源整理--持续更新 Python入门视频教程 抽象基类与接口,共性与个性的选择!(区别) C#中值类型和引用类型 通过IIS自带工具Iisapp.vbs查询哪个站点占用资源 主键与外键 分布式缓存BeIT Memcached简介 HttpHandlers和HttpModules接口详解 ASP.NET页面运行机制 jquery跨域获取数据以及分页 - Snow*Cao - 博客园
txt文本导入到sql server数据库
Snow*Cao · 2011-05-03 · via 博客园 - Snow*Cao

 protected void Button1_Click(object sender, EventArgs e)
    {
        StreamReader sr = new StreamReader(new FileStream(@"C:\test.txt", FileMode.Open, FileAccess.Read), System.Text.Encoding.Default);

        SqlConnection cn = new SqlConnection("Server=server0.;uid=sa;pwd=1234;database=ISUZU"); ;

        string insertCmd = "insert into EPSubtute(Escmp,Esoem,Esrelation,Esnew,Espart,Essub) values (@Escmp,@Esoem,@Esrelation,@Esnew,@Espart,@Essub)";
          
        string strTemp = sr.ReadLine();
        while(strTemp != null)
        {           
            SqlCommand cmd =  new SqlCommand(insertCmd, cn);
           
            cmd.Parameters.Add("@Escmp", SqlDbType.VarChar).Value = "ISUZU";
            cmd.Parameters.Add("@Esoem", SqlDbType.VarChar).Value = "IZ";
            cmd.Parameters.Add("@Esrelation", SqlDbType.VarChar).Value =strTemp.Substring(0,2) ;
            cmd.Parameters.Add("@Esnew", SqlDbType.VarChar).Value = strTemp.Substring(2, 10);
            cmd.Parameters.Add("@Espart", SqlDbType.VarChar).Value = strTemp.Substring(12, 10);
            cmd.Parameters.Add("@Essub", SqlDbType.VarChar).Value = strTemp.Substring(22, 1);

            cn.Open();
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch(System.Data.SqlClient.SqlException e1)
            {
                Console.WriteLine(e1.Message);
            }
            cn.Close();
            strTemp = sr.ReadLine();
        }
        sr.Close();
    }