110,566
社区成员
发帖
与我相关
我的任务
分享
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
string strConn = @"Provider = Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source =" + filePath;
OleDbConnection conn = = new OleDbConnection(strConn);
conn.Open();
System.Data.DataTable dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
conn.Close();
List<string> tblName = new List<string>();
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
tblName.Add(dt.Rows[i]["TABLE_NAME"].ToString());
}
using System;
using System.Globalization;
using System.Threading;
DateTime dt = DateTime.Now;
CultureInfo ci = new CultureInfo("en-US");
// Displays dt, formatted using the ShortDatePattern
// and the CultureInfo.
Console.WriteLine(dt.ToString("MM/dd/yyyy", ci));