日期:2014-05-18 浏览次数:21110 次
public int InsertPerson(DataRow newper) { switch(dbtype) { case 0: //sqlserver sql="insert into() values()"; break; case 1: //mysql sql="insert into() values()"; break; } return this.icon.ExecuteInsert(sql); }
------解决方案--------------------
可以这样:
public int InsertPerson(DataRow newper) { int ret=-1; switch(dbtype) { case 0: //sqlserver sql="insert into() values()"; ret=this.icon.ExecuteInsert(sql); break; case 1: //mysql sql="insert into() values()"; ret=this.icon.ExecuteInsert(sql); break; } return ret; //请问return 的值该怎么写啊?多谢~~ }
------解决方案--------------------
public int ExecuteInsert(string argSqlInsert) { SqlCommand sqlExecuteCommand = new SqlCommand(argSqlInsert, dbConnection); if (dbTrans != null) sqlExecuteCommand.Transaction = dbTrans; object ret = sqlExecuteCommand.ExecuteScalar(); return (int)ret; } public int InsertPerson(DataRow newper) { switch(dbtype) { case 0: //sqlserver sql="insert into() values()"; break; case 1: //mysql sql="insert into() values()"; break; } return this.icon.ExecuteInsert(sql); }
------解决方案--------------------
public int InsertPerson(DataRow newper) { object myObject=new Object(); switch(dbtype) { case 0: //sqlserver sql="insert into() values()"; myObject=this.icon.ExecuteInsert(sql); //接收ExcecuteInsert(sql)的结果 case 1: //mysql sql="insert into() values()"; myObject=this.ic