当前位置:Gxlcms > 数据库问题 > .net创建页面进行sqlload操作

.net创建页面进行sqlload操作

时间:2021-07-01 10:21:17 帮助过:2人阅读

同与异

StreamReader sr = new StreamReader(FileName)
StreamReader sr = File.OpenText(FileName)

前者只是声明了一个StreamReader ,而后者在声明后进行了一系列检查操作,然后打开了这个流。

因为多做了很多工作,后者比起前者性能差一些,占用的内存页多一些

3.利用FileUpload控件,打开文件控制大小,否则出现连接已重置错误,解决方法:

在web.config中找到<system.web></system.web>,在其中加入<httpRuntime maxRequestLength="102400" executionTimeout="60" appRequestQueueLimit="100"/>(maxRequestLength为最大文件大小,executionTimeout为最大响应时间)

4.调用cmd命令(基本格式)

System.Diagnostics.ProcessStartInfo pro = new System.Diagnostics.ProcessStartInfo("cmd.exe");
        pro.UseShellExecute = false;
        pro.RedirectStandardOutput = true;
        pro.RedirectStandardError = true;
        pro.Arguments = "/K D:\\sqlload\\cmd.bat";//文件路径
        pro.WorkingDirectory = "D:\\sqlload\\";//文件路径
        System.Diagnostics.Process proc = System.Diagnostics.Process.Start(pro);
        System.IO.StreamReader sOut = proc.StandardOutput;
        proc.Close();
        string results = sOut.ReadToEnd().Trim();
        sOut.Close();

.net创建页面进行sqlload操作

标签:

人气教程排行