资源简介

采用DataTable和DataGrid两种导出方式,导出格式默认为xls,可以自行更改后缀。 导入采用直接把数据导入到数据库的方式。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace WebApplication2
{
    public class DBHelper
    {
        /// 
        /// 增加
        /// 

        /// 人员类
        /// 成功返回1,否则返回0
        public static int Add(Person per)
        {
            int count = 0;
            string cmdText = “insert into Table_1(idjxmsnum) values(@Name@Age@Address@Phone)“;
            //Table_1为表名
            SqlConnection conn = new SqlConnection(SqlConn.ConnText);
            try
            {
                //打开连接
                if (conn.State == ConnectionState.Broken || conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }

                SqlCommand cmd = new SqlCommand(cmdText conn);
                SqlParameter[] sqlparas = { new SqlParameter(“@Name“per.Name)
                                          new  SqlParameter(“@Age“per.Age)
                                          new SqlParameter(“@Address“per.Address)
                                          new SqlParameter(“@Phone“per.Phone)
                                          };
                cmd.Parameters.AddRange(sqlparas);

                count = cmd.ExecuteNonQuery();

            }
            catch (Exception exc)
            {
                throw exc;
            }
            finally
            {
                conn.Close();
            }
            return count;
        }

        public static DataTable getRows()
        {
            //该方法用来返回表中的所有数据,该方法返回一个DataTable对象。调用该方法时需要传入一个string类型的参数,
            //该参数为需要执行的SQL语句
            DataSet ds;
            SqlConnection con = new SqlConnection(SqlConn.ConnText);
            con.Open();
            string sql = “select * from Table_1“;
            SqlDataAdapter sda = new SqlDataAdapter(sql con);
            ds = new DataSet();
            sda.Fill(ds);
            con.Close();
            return ds.Tables[0];
        }


    }

}

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

     文件      85874  2016-01-05 16:38  WebApplication2\.vs\config\applicationhost.config

    ..A..H.    115712  2016-01-06 14:26  WebApplication2\.vs\WebApplication2\v14\.suo

     文件     151288  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\lib\net40\Microsoft.ApplicationInsights.dll

     文件     134987  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\lib\net40\Microsoft.ApplicationInsights.xml

     文件     149752  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\lib\net45\Microsoft.ApplicationInsights.dll

     文件     135417  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\lib\net45\Microsoft.ApplicationInsights.xml

     文件     145656  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\lib\portable-win81+wpa81\Microsoft.ApplicationInsights.dll

     文件     132678  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\lib\portable-win81+wpa81\Microsoft.ApplicationInsights.xml

     文件     144624  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\lib\wp8\Microsoft.ApplicationInsights.dll

     文件     135798  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\lib\wp8\Microsoft.ApplicationInsights.xml

     文件     313735  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.1.2.3\Microsoft.ApplicationInsights.1.2.3.nupkg

     文件    1844368  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.Agent.Intercept.1.2.0\lib\net40\Microsoft.AI.Agent.Intercept.dll

     文件    1843432  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.Agent.Intercept.1.2.0\lib\net45\Microsoft.AI.Agent.Intercept.dll

     文件    1458435  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.Agent.Intercept.1.2.0\Microsoft.ApplicationInsights.Agent.Intercept.1.2.0.nupkg

     文件        453  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\content\ApplicationInsights.config.install.xdt

     文件        162  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\content\ApplicationInsights.config.transform

     文件        494  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\content\ApplicationInsights.config.uninstall.xdt

     文件      52480  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\lib\net40\Microsoft.AI.DependencyCollector.dll

     文件      42618  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\lib\net40\Microsoft.AI.DependencyCollector.xml

     文件      55552  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\lib\net45\Microsoft.AI.DependencyCollector.dll

     文件      50384  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\lib\net45\Microsoft.AI.DependencyCollector.xml

     文件      64809  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.DependencyCollector.1.2.3\Microsoft.ApplicationInsights.DependencyCollector.1.2.3.nupkg

     文件     138571  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.javascript.0.15.0-build58334\content\scripts\ai.0.15.0-build58334.js

     文件      57271  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.javascript.0.15.0-build58334\content\scripts\ai.0.15.0-build58334.min.js

     文件      36693  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.javascript.0.15.0-build58334\Microsoft.ApplicationInsights.javascript.0.15.0-build58334.nupkg

     文件       1900  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.javascript.0.15.0-build58334\tools\prefix.html

     文件       1705  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.PerfCounterCollector.1.2.3\content\ApplicationInsights.config.install.xdt

     文件        162  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.PerfCounterCollector.1.2.3\content\ApplicationInsights.config.transform

     文件        506  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.PerfCounterCollector.1.2.3\content\ApplicationInsights.config.uninstall.xdt

     文件      67336  2016-01-05 16:38  WebApplication2\packages\Microsoft.ApplicationInsights.PerfCounterCollector.1.2.3\lib\net40\Microsoft.AI.PerfCounterCollector.dll

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

评论

共有 条评论