cmd.CommandText = "插入 person (cardID, age, birth,tel,jiguan,rational,edu,health,workdate,name,politicalStatus,hobbies,"& _
"retiredPost,title,address,leaOrRetire,retireTime,proTecPost,proSpecialty,partyBranch,"& _
"partyTime,presonalClass,organName,partyStanding,retiredDep,guanZhu,jianli,sex,fuZhu)"& _
"Values(?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,? ,?,?,?,?);Select SCOPE_IDENTITY()"
cmd.Parameters.Add("@cardID",cardID)
cmd.Parameters.Add("@age",age)
cmd.Parameters.Add("@birth",birth)
cmd.Parameters.Add("@tel",tel)
cmd.Parameters.Add("@jiguan",jiguan)
cmd.Parameters.Add("@rational",rational)
cmd.Parameters.Add("@edu",edu)
cmd.Parameters.Add("@health",health)
cmd.Parameters.Add("@workdate",workdate)
cmd.Parameters.Add("@name",name)
cmd.Parameters.Add("@politicalStatus",politicalStatus)
cmd.Parameters.Add("@hobbies",hobbies)
cmd.Parameters.Add("@retiredPost",retiredPost)
cmd.Parameters.Add("@title",title)
cmd.Parameters.Add("@address",address)
cmd.Parameters.Add("@leaOrRetire",leaOrRetire)
cmd.Parameters.Add("@retireTime",retireTime)
cmd.Parameters.Add("@proTecPost",proTecPost)
cmd.Parameters.Add("@proSpecialty",proSpecialty)
cmd.Parameters.Add("@partyBranch",partyBranch)
cmd.Parameters.Add("@partyTime",partyTime)
cmd.Parameters.Add("@presonalClass",presonalClass)
cmd.Parameters.Add("@organName",organName)
cmd.Parameters.Add("@partyStanding",partyStanding)
cmd.Parameters.Add("@retiredDep",retiredDep)
cmd.Parameters.Add("@guanZhu",guanZhu)
cmd.Parameters.Add("@jianli",jianli)
cmd.Parameters.Add("@sex",sex)
cmd.Parameters.Add("@fuZhu",fuZhu)
'cmd.Parameters.Add("@photo", "0x" + ImageString + "" )
cmd.ExecuteNonQuery
Dim id As Integer = cmd.ExecuteScalar()
MessageBox.Show(id)
cmd.CommandText = "更新 person set photo = 0x" + ImageString + " where _Identify = "& id-1
'cmd.ExecuteNonQuery()
通过这个方式插入的照片,比如新的id是19,但是获得的id总是20?为啥?