dibax10
Messages postés65Date d'inscriptiondimanche 25 avril 2010StatutMembreDernière intervention28 mars 2013
-
18 avril 2011 à 00:08
dibax10
Messages postés65Date d'inscriptiondimanche 25 avril 2010StatutMembreDernière intervention28 mars 2013
-
18 mai 2011 à 11:51
[u]Bonsoir,
j'ai un petit probléme quand j ajoute une cotisation sa me donne une erreur( conversion failed when converting date and / or time from character string)
voila mon code :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dr = dt.NewRow
dr(0) = Ref.Text
dr(1) = mpayer.Text
dr(2) = DateTimePicker1.Text
dr(3) = ComboBox1.Text
dt.Rows.Add(dr)
da.InsertCommand = co.CreateCommand
da.InsertCommand.CommandText = "insert into cotisation values(" & Ref.Text & "," & mpayer.Text & ",'" & DateTimePicker1.Value & "'," & ComboBox1.SelectedValue & ")"
da.Update(ds, "cotisation")
MsgBox("ajoue reussi", MsgBoxStyle.Exclamation)
Ref.Text = ""
mpayer.Text = ""
DateTimePicker1.Text = ""
ComboBox1.Text = ""
Ref.Focus()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
End Sub
Private Sub FormSkin1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FormSkin1.Load
da.SelectCommand = co.CreateCommand
da.SelectCommand.CommandText = "select * from cotisation "
da.Fill(ds, "cotisation")
dt = ds.Tables("cotisation")
da1.SelectCommand = co.CreateCommand
da1.SelectCommand.CommandText = " select code_a from adherent"
da1.Fill(ds1, "adherent")
dt1 = ds1.Tables("adherent")
ComboBox1.DataSource = dt1
ComboBox1.ValueMember = "code_a"
End Sub
dibax10
Messages postés65Date d'inscriptiondimanche 25 avril 2010StatutMembreDernière intervention28 mars 2013 18 mai 2011 à 11:51
Oui désolé j'ai pas fais attention
J'ai trouvé la solution:
Format(CType(Me.Datevisa.Text, DateTime), "yyy-MM-dd")
Comme sa il prend la format de date dans la base de donnée
Bonne journée.
dibax10
Messages postés65Date d'inscriptiondimanche 25 avril 2010StatutMembreDernière intervention28 mars 2013 18 mai 2011 à 10:03
Bonjour ,
Désoler d'avoir tarder a répondre j'ai cru trouver la solution mais malheureusement non.
C'est dans la ligne da.update(ds,"cotisation) qu'il me donne l'erreur
et enfaite quand je change datetimepiker avec un controle textbox sa marche et je l'ai declaré en base de donnée en type date .
Merci
Calade
Messages postés1207Date d'inscriptiondimanche 20 avril 2003StatutMembreDernière intervention 4 juin 201610 18 mai 2011 à 10:11
Désolé aussi,
Mais je viens de m'apercevoir que tu développes en .NET ET NON EN VB6 comme la catégorie où tu as posté. Ne connaissant pas .NET je ne peux pas t'aider.
La prochaine fois fais attention où tu postes, tu aurais évité de faux espoirs et moi de perdre mon temps.