//excel导入数据库 private dataset createdatasource() { string strcon; strcon = provider=microsoft.jet.oledb.4.0;data source= + server.mappath(/net_admin/exportcj/excel.xls) + ; extended properties=excel 8.0;; oledbconnection olecon =
//excel导入数据库
private dataset createdatasource()
{
string strcon;
strcon = provider=microsoft.jet.oledb.4.0;data source= + server.mappath(/net_admin/exportcj/excel.xls) + ; extended properties=excel 8.0;;
oledbconnection olecon = new oledbconnection(strcon);
oledbdataadapter myda = new oledbdataadapter(select * from [sheet1$], strcon);
dataset myds = new dataset();
myda.fill(myds);
return myds;
}
///
/// 字符串过滤
///
/// 传来参数
/// 过滤后的字符串
public string filterstr(string strvalue)
{
string strfilter = ;|%|*|and|exec|insert|select|delete|update|count|chr|mid|master|truncate|char|declare|script;
string[] strfil = strfilter.split('|');
foreach ( string str in strfil)
{
strvalue = strvalue.replace(str,);
}
return strvalue;
}