方法如下:
1.int代表整形。
2.string 代表 字符型。
3.datetime ,日期类型判断如下
if(account.date!=Datetime.MinValue)
{
Str1.Append("date=' "+account.date+" ', ")
}
public int Update(AccountInfo account)
{
StringBuilder str1=new StringBuilder();
StringBuilder str2=new StringBuilder(); // int
if( account.number!=)
{
str1.Append("Number="+account.number",")
}else
{
str1.Append(" Number=null , ");
} //string
if(account.Name!=null&&account.Name!="")
{
str1.Append("Name=' " + account.Name+ " ' ,");
}else
{
str1.Append(" Name=' ' , ");
} str2.Append(" update table set ");
str2.Append(str1.ToString().Remove(str1.Length-));
str2.Append(" where ID="+ Account.ID+"");
return SqlHelper.ExecuteSql(str2.ToString); }