日期:2014-05-19  浏览次数:20506 次

我在HTML模板中现在BIT字段问题!顶者有分!谢谢!
我在HTML模板中现在BIT字段问题!BIT字段是布尔值在显示的时候,都是True和False
我向吧True替换成这个符号“●”False替换成“-”应该如何?需要判断吗?
我的代码如下:
public   class   ParaStructure  
{
public   int   P_AutoID;
public   string   P_jsAqqn;
public   string   P_fjsAqqn;
public   string   P_qptbqn;
}
public   static   void   Para(int   Autoid)  
{
SqlConnection   con=DataCon.AutoCon();
SqlCommand   cmd=new   SqlCommand( "AutoInfoGetList ",con);
cmd.CommandType=CommandType.StoredProcedure;
SqlParameter   DID=new   SqlParameter( "@Aid ",SqlDbType.Int,4);
DID.Value=Autoid;
cmd.Parameters.Add(DID);
con.Open();
SqlDataReader   dr=cmd.ExecuteReader();
ParaStructure   PV=new   ParaStructure();
if(dr.Read())
{
PV.P_AutoID=Convert.ToInt32(dr[ "AutoID "]);
}
dr.Close();
con.Close();
SqlConnection   coe   =   DataCon.AutoCon();

SqlCommand   cmi   =   new   SqlCommand( "AutoConfigure_cheGetList ",coe);
cmi.CommandType   =   CommandType.StoredProcedure;
SqlParameter   DIDD   =   new   SqlParameter( "@Aid ",SqlDbType.Int,4);
DIDD.Value   =   Autoid;
cmi.Parameters.Add(DIDD);
coe.Open();

SqlDataReader   di   =   cmi.ExecuteReader();
ParaStructure   PVV   =   new   ParaStructure();
if(di.Read())
{
PVV.P_jsAqqn   =   di[ "jsAqqn "].ToString();
PVV.P_fjsAqqn   =   di[ "fjsAqqn "].ToString();
PVV.P_qptbqn   =   di[ "qptbqn "].ToString();
}
di.Close();
coe.Close();
string   path   =   HttpContext.Current.Server.MapPath( "../AutoDataShow/ ");
Encoding   code   =   Encoding.GetEncoding( "gb2312 ");  
string   temp   =   HttpContext.Current.Server.MapPath( "../AutodataShow/ParaConfigure.html ");
StreamReader   sr=null;  
StreamWriter   sw=null;  
string   str= " ";  
try  
{  
sr   =   new   StreamReader(temp,   code);  
str   =   sr.ReadToEnd();
}  
catch(Exception   exp)  
{  
HttpContext.Current.Response.Write( "读参数模板时出错信息为: "+exp.Message);  
HttpContext.Current.Response.End();  
sr.Close();  
}
string   htmlfilename=PV.P_AutoID+ "Configure.html ";
str   =   str.Replace( "#AutoID# ",PV.P_AutoID.ToString());
str   =   str.Replace( "#jsAqqn# ",PVV.P_jsAqqn.ToString());
str   =   str.Replace( "#fjsAqqn# ",PVV.P_fjsAqqn.ToString());
str   =   str.Replace( "#qptbqn# ",PVV.P_qptbqn.ToString());

------解决方案--------------------
if( PVV.P_jsAqqn!=null && PVV.P_jsAqqn.ToString() == "True " )
{
str = str.Replace( "#jsAqqn# ", "● " );
}
else
{
str = str.Replace( "#jsAqqn# ", "- " );
}