以下方法正常情況下一閃就執行完了
有時候不知道爲什麽抽風(執行要4-5秒),表中數據量就一千多,四欄資料
不知道SQLServer服務器有什麽問題,有什麽調整什麽東西?求大神回覆
Sql也很簡短,沒有鎖
Sql="select arg_value as mail_no from lremailset a(nolock) where arg_type='A' and user_no='" + UserID + "'"
網上有說調整ARITHABORT的參數,試了沒有用
SET ARITHABORT On
SET ARITHABORT OFF
目前重啟SQLServer服務器可以解決問題,但是老是重啟也不是辦法
public string GetMaxNo(string UserID)
{
string SQL = "";
DataTable dtMail = new DataTable();
try
{
using (SQLHelper conn = new SQLHelper())
{
if (conn.OpenConnection())
{
SQL = "select arg_value as mail_no from lremailset a(nolock) where arg_type='A' and user_no='" + UserID + "'";
dtMail = conn.OpenDataTable(SQL, CommandType.Text);
if (dtMail.Rows.Count > 0)
{
return dtMail.Rows[0]["mail_no"].ToString();
}
}
conn.CloseConnection();
}
}
catch (Exception ex)
{
WebPublic.LogHelper.WriteLog("GetMaxNo"+UserID, ex);
throw ex;
}
return "0";
}