0

运行查询时出现此错误:

解析查询时出错。[令牌行号= 1,令牌行偏移量= 157,错误令牌= SELECT]

这正是我在使用 2008 R2 时写东西时会使用的...

这是查询:

INSERT INTO tblExample([Example], [GroupID], [Key], [Value], [ExpectedColumn]) 
VALUES (@Example, @GroupID, @k, @v, @ExpectedColumn);
SELECT @@IDENTITY;

执行:

if (db == null) { throw new Exception("You must give me an actiavted DBCon!"); }
object ret = null;
db.Command.CommandText = query;
AddParameters(db.Command, parameters);

if (db.Connection.State != ConnectionState.Open)
    db.Connection.Open();

var temp = db.Command.ExecuteScalar();
if (temp != null && temp != DBNull.Value)
{
    ret = temp;
}
return ret;
4

0 回答 0