1
我有這樣的代碼應該更新我的訪問數據庫,但我不斷收到一個錯誤說:的Visual Basic 2010錯誤訪問數據庫更新查詢
這是不可能如此更改或刪除,因爲該表的regists 'MembrosCompasso'有相關記錄。
這是我的代碼:
Dim query1 As String = "UPDATE MembrosCompasso SET [email protected]_bi WHERE MembrosCompasso.BI=Membros.BI" ' [email protected], Membros.Mae=mae WHERE [email protected]"
Dim query As String = "UPDATE Membros SET [email protected]_bi, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] WHERE [email protected]"
con.Close()
con.Open()
Dim command As New OleDbCommand(query, con)
Dim command1 As New OleDbCommand(query1, con)
' Indicação dos parâmetros que serão actualizados
command1.Parameters.Add("@compass_bi", OleDbType.VarChar).Value = BI.Text
command.Parameters.Add("@num_bi", OleDbType.VarChar).Value = BI.Text
command.Parameters.Add("@nome", OleDbType.VarChar).Value = Nome.Text
command.Parameters.Add("@hablitacoes", OleDbType.VarChar).Value = hablitacoes.Text
command.Parameters.Add("@contribuinte", OleDbType.VarChar).Value = ncront.Text
command.Parameters.Add("@telemov", OleDbType.VarChar).Value = telmov.Text
command.Parameters.Add("@natnasc", OleDbType.VarChar).Value = datnasc.Text
command.Parameters.Add("@localnasc", OleDbType.VarChar).Value = NascLocal.Text
command.Parameters.Add("@databapt", OleDbType.VarChar).Value = DataBapt.Text
command.Parameters.Add("@localbapt", OleDbType.VarChar).Value = LocalBapt.Text
command.Parameters.Add("@sexo", OleDbType.VarChar).Value = sexo.Text
command.Parameters.Add("@natu", OleDbType.VarChar).Value = natu.Text
command.Parameters.Add("@prof", OleDbType.VarChar).Value = profi.Text
command.Parameters.Add("@estadciv", OleDbType.VarChar).Value = estciv.Text
command.Parameters.Add("@datacas", OleDbType.VarChar).Value = datcas.Text
command.Parameters.Add("@localcas", OleDbType.VarChar).Value = localcas.Text
command.Parameters.Add("@notas", OleDbType.VarChar).Value = notas.Text
command.Parameters.Add("@email", OleDbType.VarChar).Value = email.Text
command.Parameters.Add("@BI", OleDbType.VarChar).Value = numero_BI
還有就是我的Access數據庫模式here的屏幕截圖。
thanx那是問題 – user1341926 2012-05-01 20:02:30