⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 excel.txt

📁 非常好的.net学习经验记录
💻 TXT
字号:
private void bind()
		{
			OleDbConnection con =new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source="+Server.MapPath("abc.xls"));
OleDbDataAdapter da =new OleDbDataAdapter("select * from [users$]",con);
			DataSet ds =new DataSet();
			da.Fill(ds);
			dg.DataSource =ds.Tables[0].DefaultView;
			dg.DataBind();
		}



OleDbConnection con =new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source="+Server.MapPath("abc.xls"));
OleDbDataAdapter da =new OleDbDataAdapter("select * from [users$]",con);
			ds.DataSetName ="students";
			da.Fill(ds,"学生表");
			dg.DataSource =ds.Tables[0].DefaultView;
			dg.DataBind();
			ds.WriteXml(MapPath("abc.xml"),XmlWriteMode.IgnoreSchema);
//			SqlConnection con1=new SqlConnection("server=(local);database=demo;uid=sa;pwd=;");
//			SqlDataAdapter da1 =new SqlDataAdapter("select * from students",con1);
//			da1.Update(ds);
			

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -