• 大小: 51KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-06
  • 语言: C#
  • 标签: C#  

资源简介

C# 从Excel导入数据到DataGridView、SqlServer,C# 从Excel导入数据到DataGridView、SqlServerC# 从Excel导入数据到DataGridView、SqlServerC# 从Excel导入数据到DataGridView、SqlServerC# 从Excel导入数据到DataGridView、SqlServerC# 从Excel导入数据到DataGridView、SqlServer

资源截图

代码片段和文件信息

using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using System.Security.Cryptography;
using System.Security.Authentication;


/// 
///DB 的摘要说明
/// 

public class DB
{
public DB()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
    public SqlConnection GetCon()
    {
        return new SqlConnection(“Server=;User Id=sa;Pwd=sa;Database=“);
    }

    public DataSet returnDS(string cmdstr)
    {
        SqlConnection con = GetCon();
        SqlDataAdapter da = new SqlDataAdapter(cmdstr con);
        DataSet ds = new DataSet();
        da.Fill(ds);
        return ds;
    }
    public int ExecuteSql(string strSql)
    {
        SqlConnection con = GetCon();
        SqlCommand cmd = new SqlCommand(strSql con);
        try
        {
            con.Open();
            int rowsAffected = cmd.ExecuteNonQuery();
            return rowsAffected;
        }
        catch (System.Data.SqlClient.SqlException e)
        {
            throw e;
        }
        finally
        {
            con.Close();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        923  2011-11-10 10:22  ExcelImport\ExcelImport.sln

    ..A..H.     15360  2011-11-18 10:51  ExcelImport\ExcelImport.suo

     文件       1178  2011-11-18 10:52  ExcelImport\ExcelImport\DB.cs

     文件       3766  2011-11-10 14:06  ExcelImport\ExcelImport\ExcelImport.csproj

     文件       8887  2011-11-18 10:50  ExcelImport\ExcelImport\Form1.cs

     文件       8829  2011-11-17 18:01  ExcelImport\ExcelImport\Form1.Designer.cs

     文件       7107  2011-11-17 18:01  ExcelImport\ExcelImport\Form1.resx

     文件        492  2011-11-10 10:22  ExcelImport\ExcelImport\Program.cs

     文件       1378  2011-11-10 10:21  ExcelImport\ExcelImport\Properties\AssemblyInfo.cs

     文件       2872  2011-11-10 10:21  ExcelImport\ExcelImport\Properties\Resources.Designer.cs

     文件       5612  2011-11-10 10:21  ExcelImport\ExcelImport\Properties\Resources.resx

     文件       1096  2011-11-10 10:22  ExcelImport\ExcelImport\Properties\Settings.Designer.cs

     文件        249  2011-11-10 10:21  ExcelImport\ExcelImport\Properties\Settings.settings

     文件        840  2011-11-18 10:42  ExcelImport\ExcelImport\obj\Debug\ExcelImport.csproj.FileListAbsolute.txt

     文件        847  2011-11-15 14:34  ExcelImport\ExcelImport\obj\Debug\ExcelImport.csproj.GenerateResource.Cache

     文件      16384  2011-11-16 17:06  ExcelImport\ExcelImport\obj\Debug\ExcelImport.exe

     文件        180  2011-11-15 14:34  ExcelImport\ExcelImport\obj\Debug\ExcelImport.Form1.resources

     文件      34304  2011-11-16 17:06  ExcelImport\ExcelImport\obj\Debug\ExcelImport.pdb

     文件        180  2011-11-10 14:09  ExcelImport\ExcelImport\obj\Debug\ExcelImport.Properties.Resources.resources

     文件      16384  2011-11-16 17:06  ExcelImport\ExcelImport\bin\Debug\ExcelImport.exe

     文件      34304  2011-11-16 17:06  ExcelImport\ExcelImport\bin\Debug\ExcelImport.pdb

     文件      14328  2011-11-18 10:42  ExcelImport\ExcelImport\bin\Debug\ExcelImport.vshost.exe

     文件        490  2007-07-21 01:33  ExcelImport\ExcelImport\bin\Debug\ExcelImport.vshost.exe.manifest

     目录          0  2011-11-18 10:51  ExcelImport\ExcelImport\obj\Debug\TempPE

     目录          0  2011-11-18 10:51  ExcelImport\ExcelImport\obj\Debug\Refactor

     目录          0  2011-11-18 10:51  ExcelImport\ExcelImport\obj\Debug

     目录          0  2011-11-18 10:51  ExcelImport\ExcelImport\bin\Debug

     目录          0  2011-11-18 10:51  ExcelImport\ExcelImport\Properties

     目录          0  2011-11-18 10:51  ExcelImport\ExcelImport\obj

     目录          0  2011-11-18 10:51  ExcelImport\ExcelImport\bin

............此处省略5个文件信息

评论

共有 条评论