You are on page 1of 1

Dim cont As Integer Dim num_reg As Integer Dim strConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & "F:\Projeto Ponto\Cont_ponto_novo.

accdb" & ";" Dim strSQL As String = "Select * from tab_horario where cod_prof = " & " '" & COD_PROFTextBox.Text & "'" & " and dia_sem = " & "'" & TextBox2.Text & "'" Dim conexaoBD As New OleDbConnection(strConn) Dim ds As DataSet = New DataSet() Dim ds1 As DataSet = New DataSet() Dim Cmd As New OleDbDataAdapter(strSQL, conexaoBD) Dim Dados_ponto As DataRow Dim dt As DataTable Cmd.Fill(ds, "tab_horario") 'DataGridView2.DataSource = ds.Tables("tab_horario").DefaultView num_reg = ds.Tables("tab_horario").Rows.Count For cont = 0 To num_reg - 1 TextBox3.Text = ds.Tables("tab_horario").Rows(cont)("cod_prof").ToSt ring TextBox4.Text = ds.Tables("tab_horario").Rows(cont)("dia_sem").ToStr ing TextBox5.Text = ds.Tables("tab_horario").Rows(cont)("hora_ini").ToSt ring TextBox6.Text = ds.Tables("tab_horario").Rows(cont)("hora_fim").ToSt ring MsgBox(cont) ds1.Reset() 'Reseta o DataSet porque no pode estar carregada e Cria o insert com todos os campos e valores Dim SQL As String = "update into tab_ponto(cod_prof, data_ponto, hor a_ini, hora_fim) " & " values " & "('" & TextBox3.Text & "','" & DATA_PONTODateT imePicker.Value & "','" & TextBox5.Text & "','" & TextBox6.Text & "')" Cmd.Fill(ds1, "tab_ponto") dt = ds1.Tables(0) Next DataGridView2.DataSource = ds1.Tables("tab_ponto").DefaultView

You might also like