EDN Admin
Well-known member
Hi, I have found many articles on this topic but none have seemed to work for me yet.
I have software that records data as a dbf file and I am wanting to refresh that data from time to time to an access database via a Visual Basic 2010 program I have made. I can import directly to a datagridview but I want to send it straight to the access
database and then call the data from there. Because I want to refresh it regulary I can not have it re-writing data that is already in there.
Here is my code I have to import it to a datagridview.
<pre class="prettyprint lang-vb Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:;Extended Properties=dBASE IV;"
Dim myConn As New OleDbConnection
Dim curDate As String
curDate = txtDate.Text
myConn.ConnectionString = connString
Dim da As OleDbDataAdapter = New OleDbDataAdapter("select * from CTSLogDT where Date like %" & curDate & "% and Status like %StartFeed%", myConn)
Dim ds As DataSet = New DataSet
Try
da.Fill(ds, "CTSLogDT")
dgvDataGrid.DataSource = ds.Tables(0).DefaultView
MsgBox(ds.Tables(0).Rows.Count)
Catch ex As Exception
MsgBox("Error while connecting to databse." & vbNewLine & ex.Message)
End Try[/code]
Any help would be much appreciated.
Arg.<br/>
<br/>
View the full article
I have software that records data as a dbf file and I am wanting to refresh that data from time to time to an access database via a Visual Basic 2010 program I have made. I can import directly to a datagridview but I want to send it straight to the access
database and then call the data from there. Because I want to refresh it regulary I can not have it re-writing data that is already in there.
Here is my code I have to import it to a datagridview.
<pre class="prettyprint lang-vb Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:;Extended Properties=dBASE IV;"
Dim myConn As New OleDbConnection
Dim curDate As String
curDate = txtDate.Text
myConn.ConnectionString = connString
Dim da As OleDbDataAdapter = New OleDbDataAdapter("select * from CTSLogDT where Date like %" & curDate & "% and Status like %StartFeed%", myConn)
Dim ds As DataSet = New DataSet
Try
da.Fill(ds, "CTSLogDT")
dgvDataGrid.DataSource = ds.Tables(0).DefaultView
MsgBox(ds.Tables(0).Rows.Count)
Catch ex As Exception
MsgBox("Error while connecting to databse." & vbNewLine & ex.Message)
End Try[/code]
Any help would be much appreciated.
Arg.<br/>
<br/>
View the full article