problème requête MySql en vb 2008
slt à tous
voilà mon problème résoude que je veux récuperer l'indice du item d'un combobox pour que ce dernier soit l'id d'un champs dans ma table voilà le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If txtnom_pfl.Text = "" Then
MessageBox.Show("Il faut remplir le champ 'Profil'", "Remplissage champ", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim req As String = "select id_pf from profil where nom like'" & txtnom_pfl.Text & "'"
Dim req3 As String = "insert into profil values ('" & i & "','" & txtnom_pfl.Text & "')"
ajout = New MySqlCommand(req)
ajout.Connection = conn
Try
i = ajout.ExecuteNonQuery()
MessageBox.Show(i.ToString(), "", MessageBoxButtons.OK)
Catch ex As Exception
MessageBox.Show(ex.ToString(), "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
conn.Close()
Me.Close()
FrmSignUp.Show()
End If
End Sub |
le champ que j'en parlai se trouve dans la table profil
merci d'avance :)