Results 1 to 4 of 4

Thread: [Database System] As a local storage file - I need an advice

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2019

    Angry [Database System] As a local storage file - I need an advice


    First of all I need to mention that I am beginner in Visual Basic environment taking my first steps (started like half year ago) and my knowledge is on same level when it comes to databases.
    I would like to ask a question regarding Database systems. Let me introduce my situation first.

    What I did and watnted to achieve:
    I try to create an application with a local data-base (with DB attached to application itself). I have already read a specialized in DBs book and have seen many tutorials as well (though in many points this knowlegde seems to be outdated regarding local storage).
    Creating DB (on SQL Server .mdf), connection to it, retriving data and so on wasn't a big deal at all. That was till I exported my application (debug folder) to another computer and tried to open it.

    An error occured - (thanks to try, catch statement) with an exception that DataBase is not avaiable. (Although DataBase was also attached with application in debug folder).
    I have read plenty of topics on different forums, why is that. At the moment I am aware, that I was able to connect to a DB, because I have already SQL Service installed on my PC.

    My aim was completely different.
    I wanted to create an application with a local DB, which would not need any additional installments like SQL server.

    My knowledge:
    I am working on Visual Studio 2019 - only .mdf DataBase is avaiable, no further support towards .sdf file - and taking that into account I cannot simply attach few .dll files to make application work with Microsoft SQL CE...
    I have read also that MSAccess DB is not required to have anything to be opened by an application. Is that true?

    My questions:
    1. Is there any chance to create an SQL local-database based application and run it on another PC with no further installments?
    2. If I had created an application based on MS Access DB, would it work the way I expect it to be?
    3. Do you have any other advices for me? Sources that I could get a knowlegde and solution from?

    Thank you very much in advance!

    //Could you answer in simple language, so I would not get confused, please?

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Sydney, Australia

    Re: [Database System] As a local storage file - I need an advice

    If you use an MDF file then any machine running your app needs SQL Server Express installed. You can still use SQL Server CE if you want but it is no longer supported, so it's probably not wise. Microsoft recommend SQLite for file-based databases these days. If you use that, you don;t even necessarily need to deploy a data file as the provider can actually create it on first use, if I'm not mistaken. If you do want to go for Access, the newer ACCDB format does require the ACE database engine to be installed, but it already will be if users have Office. The old MDB format doesn't require any additional installation because the Jet database engine is basically part of Windows these days.

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Bristol, UK

    Re: [Database System] As a local storage file - I need an advice

    Welcome to VBForums

    If you are using .MDF files then it needs SQL Server installed (which can be the Express edition), but there are other valid options.

    As you have found out already, .MDB files (not other Access based files) can be used without additional installation. Just use the OLEDB equivalents of the classes you have already (eg: OLEDBConnection instead of SQLConnection), and specify the JET provider in your connection string. Note however that you must make sure that your application is compiled as 32-bit only (x86), because JET does not support 64-bit applications.

    You can also use SQLite, which is a popular choice these days.

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2019

    Re: [Database System] As a local storage file - I need an advice

    Thank you! That is a chunk of information I needed to go forward.


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