从页面上导入excel方法 谁能给我一段从从页面上导入excel的代码,我从网上找的老是出现这个错误"'Sheet1$' 不是一个有效名称。请确认它不包含无效的字符或标点,且名称不太长。" 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 怎么导出的gridvew导出打开excel赋值string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strExcelFileName + ";" + "Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; string strExcel = string.Format("select * from [{0}$]", strSheetName); 做一个页面把一个excel导入到数据库中 excel 里 你的工作薄名称(左下角) 不是 Sheet1$ 吧 public DataSet RtnExcelData(string excelpath){ string MyExcelStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelpath + ";Extended Properties=Excel 8.0"; OleDbConnection cnn = new OleDbConnection(MyExcelStr); OleDbCommand cmd = new OleDbCommand(); cmd.Connection = cnn; cmd.CommandText = "select * from [Sheet1$]"; DataSet ds = new DataSet(); OleDbDataAdapter da = new OleDbDataAdapter(); da.SelectCommand = cmd; try { cnn.Open(); da.Fill(ds); } catch { cnn.Close(); return null; } finally { cnn.Close(); } return ds;} 我给你几个资料网页,必须把分给我!http://hi.baidu.com/playboyzys12/blog/item/dfbf2df55bd19b25bc3109a2.htmlhttp://www.awayblog.cn/article.asp?xiajlxiajl$_$c5051618b195ef0135fa4182.htmlhttp://blog.csdn.net/gdjlc/archive/2010/08/13/5810311.aspx还有10几个,我现在也在弄这个,所以多些,这三个应该可以解决了。 用javascript:printme()打印,怎样才能屏蔽页码,时间,地址。急求!!!!!!!!! 菜鸟求一存储过程 <%# %> 的格式问题 showModalDialog的简单问题!!! 请教:无刷新的DropDownList联动? 关于DataGrid的一点困惑,渴求指点!!! GridView分页如何保存模板中控件值? 100分,简单问题,近来瞧瞧吧!~~~ .net网站发布后调用c写的dll出现文件读写错误 关于新闻发布系统 数据库字段的数据类型 刚才被问住的的一些问题 求解惑
gridvew导出
打开excel赋值
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strExcelFileName + ";" + "Extended Properties='Excel 8.0;HDR=NO;IMEX=1';";
string strExcel = string.Format("select * from [{0}$]", strSheetName);
public DataSet RtnExcelData(string excelpath)
{
string MyExcelStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelpath + ";Extended Properties=Excel 8.0";
OleDbConnection cnn = new OleDbConnection(MyExcelStr);
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = cnn;
cmd.CommandText = "select * from [Sheet1$]";
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = cmd;
try
{
cnn.Open();
da.Fill(ds);
}
catch
{
cnn.Close();
return null;
}
finally
{
cnn.Close();
}
return ds;
}
http://hi.baidu.com/playboyzys12/blog/item/dfbf2df55bd19b25bc3109a2.html
http://www.awayblog.cn/article.asp?xiajlxiajl$_$c5051618b195ef0135fa4182.html
http://blog.csdn.net/gdjlc/archive/2010/08/13/5810311.aspx
还有10几个,我现在也在弄这个,所以多些,这三个应该可以解决了。