WELOA.DAL/WEL/ls_xls.cs
(开头部分) 12KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data;
using WELOA.Model;
using System.IO;
namespace LSDAL_SQL
{
public class ls_xls
{
private DateSetInformation dsinfo = new DateSetInformation();
private ls_exception exlog = new ls_exception();
private ls_staffDAO staffDAO = new ls_staffDAO();
public DateSetInformation uploadfile_xls(string FileName)
{
this.dsinfo.nException = -1;
OleDbConnection selectConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileName + ";Extended Properties=Excel 8.0;");
OleDbDataAdapter adapter = new OleDbDataAdapter("select * from [Sheet1$]", selectConnection);
DataSet dataSet = new DataSet();
try
{
adapter.Fill(dataSet, 0, 10, "view");
adapter.Fill(dataSet, "all");
this.dsinfo.ds = dataSet;
File.Delete(FileName);
}
catch (Exception exception)
{
this.exlog.insexception("ls_uploadfile_xls.cs uploadfile_xls", exception.Message);
this.dsinfo.nException = 1;
return this.dsinfo;
}
return this.dsinfo;
}
public Polytechnic Write_xls(DataSet ds, string filePath)
{
Polytechnic Polytechnic = new Polytechnic {
nException = -1
};
OleDbConnection connection = new OleDbConnection();
OleDbCommand command = new OleDbCommand();
StringBuilder builder = new StringBuilder();
try
{
int num2;
connection.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + filePath + ";Extended ProPerties=\"Excel 8.0;HDR=Yes;\"";
connection.Open();
command.CommandType = CommandType.Text;
command.Connection = connection;
builder.Append("CREATE TABLE sheet1(");
int num = 0;
while (num < ds.Tables[0].Columns.Count)
{
后面还有 274 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
