difatti è quello che faccio, ma non ottengo quanto voluto,
difatti al primo click è corretto, ma dal secondo in poi me li aggiunge tutticodice:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click DataGridView1.DataBindings.Clear() DataGridView1.DataSource = Nothing DataGridView1.DataMember = Nothing DataGridView1.Refresh() Dim StringaConnessione As String = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" & Application.StartupPath & "\ore.mdb;Mode=Share Deny None;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False" Dim cn As New OleDbConnection(StringaConnessione) cn.Open() Dim da As New OleDbDataAdapter("SELECT * FROM ore where Causale= '" & ComboBox1.Text & "'", cn) da.Fill(ds, "ore") Application.DoEvents() Me.DataGridView1.DataSource = ds Me.DataGridView1.DataMember = "ore" cn.Close() End Sub

Rispondi quotando