/// 取得数据库服务器的系统日期转为字符串格式,只取日期部分
/// </summary>
/// <returns></returns>
public string GetServerSysDate(string style)
{
string Str="select getdate() ";
string constr=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToString();
SqlConnection myconnection=new SqlConnection(constr);
SqlCommand mycommand = new SqlCommand(Str, myconnection);
myconnection.Open();
DateTime dDate = Convert.ToDateTime(mycommand.ExecuteScalar());
string sDate = dDate.ToString(style);
//string maxID = mycommand.ExecuteScalar().ToString();
myconnection.Close();
return sDate;
}
/// </summary>
/// <returns></returns>
public string GetServerSysDate(string style)
{
string Str="select getdate() ";
string constr=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToString();
SqlConnection myconnection=new SqlConnection(constr);
SqlCommand mycommand = new SqlCommand(Str, myconnection);
myconnection.Open();
DateTime dDate = Convert.ToDateTime(mycommand.ExecuteScalar());
string sDate = dDate.ToString(style);
//string maxID = mycommand.ExecuteScalar().ToString();
myconnection.Close();
return sDate;
}