上图Id是自增加的标识列,用mySqlCommandBuilder(daDetail)自动生成insertcommand语句,为了能回传@@identity数据,insertcomand.commandText后面添加";select @@identity as id",但是发现改行语句完全不起作用。id值没有在datagridview中显示。
请教各位大大,我该如何修改,才能达到我的要求
Dim cbDetail As New MySqlCommandBuilder(daDetail)
daDetail.InsertCommand = cbDetail.GetInsertCommand
daDetail.InsertCommand.CommandText = daDetail.InsertCommand.CommandText & ";select @@identity as id"
daDetail.Update(dtDetail)
dtDetail.AcceptChanges()