回复 15楼 czyzhuo
如果是封装的方法,那么怎么办呢.比如:
string sql =
"INSERT tenterprisemessage (EntmesTitle,EntmesImg)" +
"VALUES (@EntmesTitle,@EntmesImg)";
sql += " ; SELECT @@IDENTITY";
try
{
MySqlParameter[] para = new MySqlParameter[]
{
new MySqlParameter("@EntmesTitle", tenterPriseMessage.EntmesTitle),
new MySqlParameter("@EntmesImg", tenterPriseMessage.EntmesImg };
int newId = (int)db.GetScalar(sql, para);
return GetTenterPriseMessageById(newId);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
throw e;
}
是不是要加到 :
new MySqlParameter("@EntmesTitle", tenterPriseMessage.EntmesTitle)
但是报错
请高手指教。