Excel 导入sqlserver c#
using System.Data.SqlClient;
using System.Data.OleDb;
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = null;
try
{
string path = "./Users.xls";
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + path + ";" +
"Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
conn = new OleDbConnection(strConn);
conn.Open();
string Sql = "select * from [Users$]";
System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand();
OleDbDataAdapter ddp = new OleDbDataAdapter(Sql, conn);
DataTable dt = new DataTable();
ddp.Fill(dt);
ddp.D
相关文档:
public void SetWindowRegion()
{
System.Drawing.Drawing2D.GraphicsPath FormPath;
FormPath =
new System.Drawing.Drawing2D.GraphicsPath();
Rectangle
rect=ne ......
之前不太喜欢C#,无意中发现linq,用来实现排序是如此简单,所以又用C#写了遍发牌程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
&nb ......
C#的功能很强大,却没有直接提供面向汉字文化的开发倾向
比如我现在要说的获取当前的星期我提供两种方法:
①,DateTime.Now.DayOfWeek ,查询MSDN可以知道该属性返回的结果是:
//
// 摘要:
// 获取 ......
SQL-Structured Query Language
--(开启SQL服务:net start mssqlserver)
--(在命令行中输入'sqlwb'命令可打开SQL管理器 )
--(如果 ......
现在一般常用的有以下2种方法:
1. select top @pagesize * from table1 where id not in (select top @pagesize*(@page-1) id from table1 order by id) order by id
2. select * from (select top @pagesize * from (select top @pagesize*@page * from table1 order by id) a order by id desc) b or ......