Excel中数据导入到SQL Server数据库
using System.Data.SqlClient;
using System.Data.OleDb;
private void tsmiImportTeacherInfo_Click(object sender, EventArgs e)
{
DataSet ds;
if (ofdImport.ShowDialog()==DialogResult.OK)
{
ds = ImportExcel(this.ofdImport.FileName); //获得Excel
}
else
{
return;
}
int odr = 0;
SqlConnection cn = db.sqlconnection();
try
{
cn.Open();
string str = "insert into Teacher (TeacherId,Pwd,eachCourse,TeacherName) values(@TeacherId,@Pwd,@TeachCourse,@TeacherName)";
SqlCommand cmd = db.sqlcommand(str,cn);
int dsLength = ds.Tables[0].Rows.Count; //获得Excel中数据长度
&
相关文档:
系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......
table a(id, type):
id type
----------------------------------
1 1
2 1
3 &n ......
项目中需要根据课件名称按月统计出访问的情况,第一次我采用了最土的一种办法,使用循环,给sql传递年月两个参数,
for(var y=2009;y<=2010;y++){
for(var m=1;m<=12;m++){
// todo : SQL 查询
}
}
这样,统计2 ......
方法一:
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),\'-\',\'\'),\' \',\'\'),\':\',\'\')
20040912110608 h
select CONVERT(varchar(12) , getdate(), 111 )
2004/09/12
select CONVERT(varchar(12) , getdate(), 11 ......
create procedure DeleteWareHouse_StoreArea_SummaryByPUR
(@po_no nvarchar(100))
as
begin
declare @cacheTable table(wh_id int);--声明一个table类型的变量
insert @cacheTable select wh_id from aps_inventory_store_area where description=@po_no--向变量@cacheTable中添加结果集
--select * from @cac ......