dcsimg
Results 1 to 4 of 4

Thread: [RESOLVED] Working with an Access database that is not shown in Solution Explorer in VS 2015

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2018
    Posts
    24

    Resolved [RESOLVED] Working with an Access database that is not shown in Solution Explorer in VS 2015

    I am trying to update a visual basic 6 program. The problem is that the user of the program place's a database County Hunter - K8EMS.accdb into Logger data folder, and the program needs to be able to use the database. When I try to connect to the database get error "unable to find database". When I add it to the program and it is in the solution explorer it will find the database.

    The problem is there are thousands of call's issued to ham radio operators in the US. I can't put them all in the solution explorer. How can I get the program to interact with the database? I have looked on the internet for 2 days and can't seem to find the info. I am sure it is mainly due to not asking the correct question. I am by no means an expert on Visual Basic 6 or Visual studio 2015, but if they could do it with Visual Basic 6 I would expect you can do it now.

    Any help pointing me in the right direction would be greatly appreciated.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,354

    Re: Working with an Access database that is not shown in Solution Explorer in VS 2015

    It doesn't matter if the database is shown in Solution Explorer.

    The issues you are having are not about that, but something wrong with the way you are trying to connect to the database (including various things like typos in the file name/path) or the database itself (but that is unlikely, as it worked when you added it to the project).

    If you show us the code you are using, we might be able to see what is causing the problem.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2018
    Posts
    24

    Re: Working with an Access database that is not shown in Solution Explorer in VS 2015

    Sorry about forgetting the code here it is

    Private Sub datagridshow()

    Dim ds As New DataSet
    Dim dt As New DataTable
    ds.Tables.Add(dt)
    Dim da As New OleDbDataAdapter

    '------------ FROM HERE THE NEXT FIVE LINES SET UP THE CONNECTION STRING FOR USER'S DATABASE------------------

    Dim mcall = lblCall.Text
    Dim strFilePrefix = "County Hunter - "
    Dim strFileSuffix = ".accdb"
    Dim databaseFile As String = "C:\RRLogger Data\" & strFilePrefix & mcall & strFileSuffix
    Dim conString = "Provider = Microsoft.Ace.OLEDB.12.0; Data Source= " & databaseFile
    '--------------------------------------------------------------------------------------------------------------
    con.ConnectionString = conString

    con.Open()

    da = New OleDbDataAdapter("SELECT * FROM [QSO - Master] ORDER BY [QSO ID] Desc", con)

    da.Fill(dt)

    DataGridView1.DataSource = dt.DefaultView

    con.Close()

    Thanks in advance for the help.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2018
    Posts
    24

    Re: Working with an Access database that is not shown in Solution Explorer in VS 2015

    I have discovered the problem it wasn't with the connection string other than the lblCall was loosing its contents when the form loaded so there was no call to insert into the mcall concatenation. I appreciate everyone that was considering the problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width