Click here to Skip to main content
13,665,205 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
how to connect to. DBF database with VB 2008 and that the show in dadagrid? thanks.
Posted 4-Mar-11 8:33am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi

Check connection strings connection strings for dbf[^]
Might be helpful.

If you already tried, Put your error or exception by using 'Improve question' option.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I found this:

Dim ConnectionString As String

       ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\;Extended Properties=dBase IV"
       Dim dBaseConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
       dBaseConnection.Open()

       Dim dBaseCommand As New System.Data.OleDb.OleDbCommand("SELECT * FROM dbase", dBaseConnection)
       Dim dBaseDataReader As System.Data.OleDb.OleDbDataReader = dBaseCommand.ExecuteReader(CommandBehavior.SequentialAccess)

       While dBaseDataReader.Read
           TextBox1.Text = (dBaseDataReader("Column1").ToString)
           TextBox2.Text = (dBaseDataReader("Column2").ToString)
           TextBox3.Text = (dBaseDataReader("Column3").ToString)
       End While

       dBaseConnection.Close()


but we show only the last line ... if anyone knows how I could do to get back to the first or next row, the last ...
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

if anyone knows how i do this??
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

'Hi
  
'Try this

'Add a datagridview and name it dbfDataGrid


'Coded by 
'jayanthimuurgesan@yahoo.com
'jayanthimuurgesan@gmail.com
'jayanthi.muurgesan.jma@gmail.com
'+91 9994438735

Public Class Form1
    Public dBaseConnection As New System.Data.OleDb.OleDbConnection
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim tb As DataTable
            tb = getdbasetable("select * from arms;")
            dbfDataGrid.DataSource = tb
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

    Public Function getdbasetable(ByVal SqlString As String) As DataTable
        Dim ReturnableTable As New DataTable
        Try
            OpendBConnection()
            Dim SelectCommand As New System.Data.OleDb.OleDbCommand(SqlString, dBaseConnection)
            Dim TableAdapter As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
            TableAdapter.SelectCommand = SelectCommand
            TableAdapter.Fill(ReturnableTable)
            Return ReturnableTable
        Catch ex As Exception
            MsgBox(ex.Message & vbCrLf & SqlString, 16, "Error")
            End
        End Try
        Return ReturnableTable
    End Function

    Public Sub OpendBConnection()
        Try
            Dim ConnectionString As String
            ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dbf_folder;Extended Properties=dBase IV"
            dBaseConnection = New System.Data.OleDb.OleDbConnection(ConnectionString)
            If dBaseConnection.State = 0 Then dBaseConnection.Open()
        Catch ex As Exception
            MsgBox(ex.Message, 16, "Error")
        End Try
    End Sub
End Class



'Thanks

'Murugesan G

'jayanthimurugesan@yahoo.com
'jayanthimurugesan@gmail.com
  Permalink  
v5
Comments
Richard Deeming 3-Nov-15 10:55am
   
Your answer adds nothing to the accepted solution posted OVER FOUR YEARS AGO!
ppolymorphe 3-Nov-15 10:58am
   
Please, no update on an already answered question.
Please, no update on a 4 year old question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180810.1 | Last Updated 3 Nov 2015
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100