代码如下:
public bool Add(Liuyan refmodel)
{
string sql = "insert into liuyan(name,phone,zhiwei,gongsi,addr,country,dianyou,content,adddate)values(@name,@phone,@zhiwei,@gongsi,@addr,@country,@dianyou,@content,@adddate)";
OleDbParameter[] parameters ={
new OleDbParameter("@name",OleDbType.VarChar),
new OleDbParameter("@tel",OleDbType.VarChar),
new OleDbParameter("@zhiwei",OleDbType.VarChar),
new OleDbParameter("@gongsi",OleDbType.VarChar),
new OleDbParameter("@addr",OleDbType.VarChar),
new OleDbParameter("@country",OleDbType.VarChar),
new OleDbParameter("@dianyou",OleDbType.VarChar),
new OleDbParameter("@content",OleDbType.VarChar),
new OleDbParameter("@adddate",OleDbType.VarChar)
};
parameters[0].Value=model.Xingming;
parameters[1].Value=model.Tel;
parameters[2].Value=model.Zhiwei;
parameters[3].Value=model.Gongsi;
parameters[4].Value=model.Addr;
parameters[5].Value=model.Country;
parameters[6].Value=model.Dianyou;
parameters[7].Value=model.Content;
parameters[8].Value=model.Adddate;
return sqlHelper.executeCommand(sql, parameters);
}
本文讲反射 现在就说在这段代码的哪个位置使用反射 只是本人编码过程中为了省劲突发奇想
代码如下:
parameters[0].Value=model.Xingming;
parameters[1].Value=model.Tel;
parameters[2].Value=model.Zhiwei;
parameters[3].Value=model.Gongsi;
parameters[4].Value=model.Addr;
parameters[5].Value=model.Country;
parameters[6].Value=model.Dianyou;
parameters[7].Value=model.Content;
新闻热点
疑难解答
图片精选