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
相关文档:
sqlserver 2000排名函数
名次生成方式1,重复时合并名次
SELECT * , Place=(SELECT COUNT(DISTINCT Score) +1 from jh03 WHERE Score >= a.Score)
from jh03 a
ORDER BY Place
名次生成方式2 , 重复时保留名次空缺
SELECT * , Place=(SELECT COUNT(Score) from jh03 WHERE Score > a.Score) + 1
from j ......
SQL-Structured Query Language
--(开启SQL服务:net start mssqlserver)
--(在命令行中输入'sqlwb'命令可打开SQL管理器 )
--(如果要执行多条命令中的一条,鼠标选定后再按F5执行)
create database sales ......
之前不太喜欢C#,无意中发现linq,用来实现排序是如此简单,所以又用C#写了遍发牌程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
&nb ......
1、新建一个类库项目
2、将Class1.cs改为我们想要的名字
问是否同时给类改名,确定
3、修改Properties目录下面的AssemblyInfo.cs
ComVisible属性设置为True
4、项目菜单->MyLib属性
找到“生成”选项卡
往下看,找到“为 COM Interop 注册”勾上
5、继续往下,找到“签名&rdqu ......