日期:2014-05-17 浏览次数:20777 次
private bool GetMaintainInfo(out string AlertError)
{
bool flag = false;
AlertError = "";
new SysClass();
try
{
string sQL = " select VehicleType,VehicleTypeID,MaintainCycle,CycleUnit,PopedomId from VehicleType where VehicleType = @VehicleType and PopedomId=@PopedomId";
SqlParameter[] sqlParams = new SqlParameter[] {
new SqlParameter("@VehicleType", SqlDbType.VarChar, 50),
new SqlParameter("@PopedomId", SqlDbType.Int)
};
sqlParams[0].Value = this.TextBox4.Text.Trim().ToString();//车辆类型
//string test0 = this.TextBox4.Text.Trim().ToString();
sqlParams[1].Value = int.Parse(this.ViewState["PopedomId"].ToString());//错误所在!!!!!!!!!这里的值为空,取不到值。
//int test = int.Parse(this.ViewState["PopedomId"].ToString());
DBClass class2 = new DBClass("ConnStr");
class2.ReadData(sQL, sqlParams);
while (class2.MyReader.Read())
{
this.ViewState["MaintainCycle"] = class2.MyReader["MaintainCycle"];
this.ViewState["CycleUnit"] = class2.MyReader["CycleUnit"];
flag = true;
}
class2.MyReader.Close();
class2.MyReader.Dispose();
class2.Conn.Close();
class2.Conn.Dispose();
if (!flag)
{
AlertError = "车辆类型【" + this.TextBox4.Text.Trim() + "】未配置";
&