關於SQL日期的轉換和讀 Excel 字符串

来源:互联网 发布:vncserver配置windows 编辑:程序博客网 时间:2024/05/23 02:05

select convert(varchar,getdate(),111) 

結果 2008/04/21

select convert(varchar,getdate(),108)

結果為時間 15:13:21

C#中轉換日期

 
        Response.Write(Convert.ToDateTime(
"2008-04-19 21:53:41.137").ToString("yyyy/MM/dd"));
        Response.Write(Convert.ToDateTime(
"2008-04-19 21:53:41.137").ToString("yyyy年MM月dd日"));

 

 

 

Excel 2007字符串

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;
               Data Source=C:Members.xlsx;Extended Properties=""Excel 12.0;HDR=YES;""
";

Excel 2003字符串
string connectionString = "Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = '" + getpath + "';Extended Properties=Excel 8.0";


原创粉丝点击