Im travaillant sur une base de données d'accès, et je veux savoir comment puis-je corriger le code ci-dessous pour que je puisse afficher les informations correctes à l'utilisateur. Le problème est, je veux afficher un message d'erreur si le OleDbCommand n'a pas réussi.Comment vérifier si un OleDbCommand réussi?
Try
cn = New OleDbConnection(" Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\ro.mdb")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select * from [Table1]", cn)
cmd.CommandText = "insert into [Table1]([LNAME], [FNAME], [MNAME], [POS], [UNAME], [PASS]) values('" + lstname + "','" + frsname + "','" + midname + "','" + post + "','" + usrname + "','" + pword + "')"
cmd.ExecuteNonQuery()
Catch
MsgBox("Either one of the text box is empty or the IDNUMBER entered is already on the database", MsgBoxStyle.Critical)
End Try