我的部分查询如下所示。我将asp.net与c结合使用。我想在查询结束时将“lastregionid”输入到我的c代码中。目前,我总是得到最后的身份证后插入\u地区\u成本。但我要的是在区域插入后面的'lastregionid'。这可能吗?有没有别的方法可以达到我想要的?
string Query = @"INSERT INTO region (" +
"REGION_USER_ID," +
"REGION_NICK_NAME," +
"REGION_POLYGON) " +
"VALUES (" +
"@Parameter1," +
"@Parameter2," +
"PolygonFromText(@Parameter3)); " +
"SET @'LastRegionID' = LAST_INSERT_ID();" +
"INSERT INTO region_cost (" +
"REGION_ID," +
"REGION_COST," +
"REGION_COST_NICK_NAME," +
"REGION_NOTES) " +
"VALUES (" +
"@'LastRegionID'," +
"@Parameter4," +
"@Parameter5," +
"@Parameter6);";
c代码的一部分。。。
if (sqlSuccess > 0)
{
oDBStatus.LastUpdatedKey = @LastRegionID ???';
oDBStatus.Type = DBOperation.SUCCESS;
oDBStatus.Message.Add(DBMessageType.SUCCESSFULLY_DATA_INSERTED);
}
else
{
oDBStatus.Type = DBOperation.ERROR;
oDBStatus.Message.Add(DBMessageType.ERROR_NO_RECORDS_UPDATED);
}
return oDBStatus;
暂无答案!
目前还没有任何答案,快来回答吧!