谁有例子啊?
ADO.NET
C#.NET的啊.
ADO.NET
C#.NET的啊.
解决方案 »
- 如何使日期默认不为1900-1-1 0:00:00
- cs程序 动态读写 resources.resx 文件?
- 为什么我的winform画面之间切换时CPU占用率会这么高呢???
- INSERT 语句与 COLUMN FOREIGN KEY 约束 'FK_NewsInfo_NewsTypeInfo' 冲突。
- 二维数组在控件显示的问题
- 我想通过Request.QueryString.add方法来添加字符,为啥说是只读的不能添加...
- 怎样写一个功能齐备的书评数据库?我是新手,请帮忙介绍一些好的例子可以吗?多谢了各位大峡
- Visual Studio .NET 2003还没有正式版吗?
- .NET Remoting 和 WEB服务概念上好像一样的,前者要比后者速度快点,那WEB服务还有意义存在吗?
- vs.net2003安装需要序列号吗?如果需要,请提供一个
- 我想得到字符串中字符的个数,但是总是不对
- b/s有缓存的概念和用法,c/s有吗?
Dim strSQL As String
Dim lngRecsAff As Long
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\test\xltestt.xls;" & _
"Extended Properties=Excel 8.0" 'Import by using Jet Provider.
strSQL = "SELECT * INTO [odbc;Driver={SQL Server};" & _
"Server=<server>;Database=<database>;" & _
"UID=<user>;PWD=<password>].XLImport9 " & _
"FROM [Customers$]"
Debug.Print strSQL
cn.Execute strSQL, lngRecsAff, adExecuteNoRecords
Debug.Print "Records affected: " & lngRecsAff cn.Close
Set cn = Nothing
这个VB怎么用C#来写啊?
{
this.SetStyle("Table");
string file="";
openFileDialog1.Filter = "Excel数据文件|*.xls";
openFileDialog1.RestoreDirectory = true;
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
file=this.openFileDialog1.FileName;
//
string conStr=@" Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = "+file+";Password=;User ID=Admin;Extended Properties=Excel 8.0" ; string cmdText="select * from [Sheet1$]"; OleDbDataAdapter a=new OleDbDataAdapter(cmdText,conStr); DataSet ds=new DataSet(); a.Fill(ds);
this.data=ds.Tables[0];
//string cols="学号,姓名,班级名称,院系名称";
this.dataGrid1.DataSource=this.data;
//
this.label1.Visible=true;
this.label2.Text="共有"+this.data.Rows.Count.ToString()+"条记录;";
}
string conStr=@" Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = "+file+";Password=;User ID=Admin;Extended Properties=Excel 8.0" ; string cmdText="select * from [Sheet1$]";
{
DataSet loRetVal = null; if (pcExcelFilePath.Trim().Length>0)
{
try
{
loRetVal = new DataSet();
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source="+pcExcelFilePath+";"+
"Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [sheet1$]", strConn);
myCommand.Fill(loRetVal);
}
catch (Exception loErr)
{
AppEnv.InfoBox(loErr.Message);
}
} return loRetVal;
}