我的项目昨天运行良好,突然开始给我这个错误。我不知道该如何解决。
public ConnectionDetails GetCustomerConnectionDetails(string Customer_GUID)
{
ConnectionDetails _conDetails = new ConnectionDetails();
try
{
using (SqlConnection sqlConn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["someconstring"].ToString()))
using (SqlCommand cmd = new SqlCommand(@"select Customer_ID ,Customer_Connection_Alias ,Customer_GUID from dbo.Connections where Customer_GUID = @Customer_GUID", sqlConn))
{
//[Customer_ID] ,[Customer_Connection_Alias] ,[Customer_GUID]
cmd.Parameters.Add("@Customer_GUID", SQL.SqlDbType.NVarChar).Value = Customer_GUID;
sqlConn.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
_conDetails.Customer_ID = reader.SqlStringValueNullCheck(reader.GetOrdinal("Customer_ID"));
_conDetails.Customer_Alias = reader.SqlStringValueNullCheck(reader.GetOrdinal("Customer_Connection_Alias"));
_conDetails.Customer_GUID = reader.SqlStringValueNullCheck(reader.GetOrdinal("Customer_GUID"));
_conDetails.Connection_Status = reader.SqlStringValueNullCheck(reader.GetOrdinal("Connection_Status"));
_conDetails.Connection_Date_Time = reader.SqlDateTimeValueNullCheck(reader.GetOrdinal("Connection_Date_Time"));
_conDetails.Connection_GUID = reader.SqlStringValueNullCheck(reader.GetOrdinal("Connection_GUID"));
}
}
}
}
catch (Exception ex)
{
throw ex;
}
return _conDetails;
}