If cmd.ExecuteScalar() Is Nothing Then '如果没有相同文件的行
MessageBox.Show(fjid)
cmd.CommandText = "Select top 1 [_Identify] From {ADAD} Where ADAD00 Is Null Order by [_Identify]"
Dim id2 As Integer = cmd.ExecuteScalar()
If cmd.ExecuteScalar() Is Nothing Then
cmd.CommandText = "Insert Into ADAD(ADAD00,ADAD01,ADAD02,ADAD03) Values('" & fjid & "','" & kz & "','" & crc & "',?)"
cmd.Parameters.clear
cmd.Parameters.Add("@ADAD03", wj)
cmd.ExecuteNonQuery
Else
'cmd.CommandText = "Select top 1 [_Identify] From {ADAD} Where ADAD00 Is Null Order by [_Identify]"
'Dim ide As Integer = cmd.ExecuteScalar()
MessageBox.Show("自增长序列:" & id2)
'cmd.CommandText = "update {ADAD} set ADAD00 = '" & fjid & "',ADAD01 = '" & kz & "',ADAD02 = '" & crc & "',ADAD03 = ? where [_Identify] = '" & id2 & "'"
MessageBox.Show(wj.Length)
cmd.CommandText = "update {ADAD} set ADAD00 = ?,ADAD01 = ?,ADAD02 = ?,ADAD03 = ? where [_Identify] = ?"
cmd.Parameters.clear
cmd.Parameters.Add("@ADAD00", fjid)
cmd.Parameters.Add("@ADAD01", kz)
cmd.Parameters.Add("@ADAD02", crc)
cmd.Parameters.Add("@ADAD03", wj)
cmd.Parameters.Add("@[_Identify]", id2)
cmd.ExecuteNonQuery
End If
End If
End If