这是类,字符串是数据库列,当我想将其调出时,如何将列设置为空?是字符串strDockey = string.Empty; ??
public class SL_CS
{
public string strDocKey { get; set; }
public string strDocNo { get; set; }
public string strDOCDATE { get; set; }
public string strPOSTDATE { get; set; }
public string strTAXDATE { get; set;}
}
在类的构造函数中初始化属性:
public class SL_CS{
// constructor gets called when you new this class
public SL_CS{
// set any properties as you would do normally
sl_cs.strDocKey = String.Empty;
}
public string strDocKey { get; set; }
public string strDocNo { get; set; }
public string strDOCDATE { get; set; }
public string strPOSTDATE { get; set; }
public string strTAXDATE { get; set;}
}
当你现在新上课时:
var inst = new SL_CS();
然后检查inst.strDocKey
它将是String.Empty。您的其他属性将为null。