110,534
社区成员
发帖
与我相关
我的任务
分享
public string GetNextStatus() {
string StrSQL;
string strTemp;
SqlConnection conn = new SqlConnection(Getconn());
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
StrSQL = "SELECT NEXTSTATUS FROM TB_LWS WHER WHERE ";
StrSQL = StrSQL + "NEXTSTATUS IN ('030','040','050') and LWSEvent = @LWSEvent";
cmd.CommandText = StrSQL;
cmd.Parameters.Add("@LWSEvent", SqlDbType.Char, 3).Value = LWSEvent;
SqlDataReader dr = cmd.ExecuteReader();
try
{
dr.Read();
if (dr.HasRows == false)
{
dr.Close();
return "030".ToString();
}
strTemp = dr["NEXTSTATUS"].ToString();
if (strTemp.Equals("030".ToString()))
{
dr.Close();
return "040".ToString();
}
if (strTemp.Equals((string)"040"))
{
dr.Close();
return "050".ToString();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw;
}
finally {
//dr.Close();
conn.Close();
}
}
try
{
}
catch
{
}
return "";