插入一条记录后,马上得到新插入记录ID值的方法

来源:互联网 发布:淘宝店费用一年多少钱 编辑:程序博客网 时间:2024/04/27 18:46

jgiCmd.CommandText = "insert into productVariant (productId, isDefault, ImageFileNameOverride) values (" & id & ", 1, '" & rd("web_image") & "'); select @@identity id"
                    strReturnValue += jgiCmd.CommandText & vbLf
                    jgiCmd.Connection = jgiCn
                    jgiCn.Open()
                    idProductVariant = jgiCmd.ExecuteScalar()