sh250080
New member
- Joined
- Feb 6, 2009
- Messages
- 3
- Programming Experience
- 3-5
Im back again I got my last problem fixed but now Ive got another. Im needing to scan through each Row in the DGV or the DB and get the value in Break1, if break1 = the current time then it only adds that row to the other table. Here is my code. Im unsure if there is a way to get like the rows number or something if it has a match but any help is appreciated.
If you viewed my last question this might look the same but its not. When I run this I had it in a For Each and it would add each row in the DGV to my database and would create a duplicate as well at the interval.
VB.NET:
Dim connection As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & My.Settings.DBcon.ToString) 'C:\agentinfo.mdb")
Dim sql As String = String.Empty
sql = "INSERT INTO type(AgentName, Type, DueBack )" _
& "VALUES(@AgentName, @Type, @DueBack)"
Dim command As New OleDbCommand(sql, connection)
command.Parameters.Add(New OleDbParameter("@AgentName", dg1.Rows(i).Cells(1).Value.ToString))
command.Parameters.Add(New OleDbParameter("@Type", "Break"))
command.Parameters.Add(New OleDbParameter("@DueBack", dg1.Rows(i).Cells(2).Value.ToString))
connection.Open()
command.ExecuteNonQuery()
connection.Close()
If you viewed my last question this might look the same but its not. When I run this I had it in a For Each and it would add each row in the DGV to my database and would create a duplicate as well at the interval.