Select field1,field2,....where blabla AND fielddate = DATE()
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim sql As String = "select * from ala23 where N=" & Val(TextBox5.Text)
If con.State() Then con.Close()
con.Open()
Dim cmd As New OleDbCommand(sql, con)
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader()
If dr.Read() = True Then
TextBox5.Text = dr.Item(0).ToString
TextBox4.Text = dr.Item(1).ToString
TextBox2.Text = dr.Item(2).ToString
TextBox1.Text = dr.Item(3).ToString
Me.DateTimePicker1.Value = dr.Item(4).ToString
TextBox3.Text = dr.Item(5).ToString
con.Close()
Else
If TextBox1.Text = "" OrElse TextBox2.Text = "" Then
MessageBox.Show("تأكد من ادخال البيانات ", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
Exit Sub
Else
Try
sql = "INSERT INTO ala23(N,NOM,ONCIEN,NOUVEAU,DATTE,SOOME)" & " values('" & Val(TextBox5.Text) & "','" & TextBox4.Text & "','" & TextBox2.Text & "','" & TextBox1.Text & "','" & DateTimePicker1.Value & "','" & TextBox3.Text & "')"
Dim cmd2 As New OleDbCommand(sql, con)
cmd2.ExecuteNonQuery()
con.Close()
viewNOW()
Catch ex As Exception
con.Close()
MessageBox.Show(ex.Message)
End Try
End If
End If
Sub viewNOW()
Dim builder As OleDbCommandBuilder = New OleDbCommandBuilder(da)
ds = New DataSet
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(ds, "Tab")
bs = New BindingSource(ds, "Tab")
Me.DGVclions.DataSource = bs
End Sub
20 avril 2017 à 12:17