Results 1 to 3 of 3

Thread: Execute query on OpenFileDialog chosen file?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2014

    Execute query on OpenFileDialog chosen file?

    So, i need to finish this project soon, and I'm stuck, firstly i made everything workusing a sample file as a data source,
    I made a combobox show me the distinct values of a column, using an sql query. Problem is, the actual files the user will use will have different names every time. that's why i chose to use the openfiledialog.

    Now, how do i replace everything so it runs the query on any Access database that is chosen using the openfiledialog?

    Is it possible in the first place? or should I resort to telling the user to rename the file to the name of the Data Source, and moving it to the same folder every time?

    The code i have at the moment to run the query on the data source is simply copied from what a FillByToolSTripButton generates, FillBy being the name of that query. Its something like this:

    Catch ex As System.Exception
    End Try
    That, along with the correct data source and display members for the combobox shows me exactly what I need.

    Please help, thanks guys!

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Chelmsford UK

    Re: Execute query on OpenFileDialog chosen file?

    you can bind your data through code:


  3. #3
    Join Date
    Sep 2005
    Modesto, Ca.

    Re: Execute query on OpenFileDialog chosen file?

    If the databases will all have the same schema then you could just change the Tableadapters connectionstring. "Me.TableAdapter1.Connection.ConnectionString = newConnectionString"

Tags for this Thread

Posting Permissions

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


Click Here to Expand Forum to Full Width