0

I made this program on vbnet express 2012, using the built in data source, and when I deploy the program copying also the mdf file, the program won't work on the client machine. My client doesn't want to install SQL server on his machine, he only want to use simple program with simple database stored in a file next to the program. It was easy back in VB6 and access mdb files, but with the mdf files, it is just not working. I tried to create mdb file database, vbnet doesn't connect to it, I read that it needs to force the cpu to x86, so decided to forget about this option I also tried this option to connect to my mdf file

Public SQLCon As New SqlConnection With {.ConnectionString = "Data Source=.;Initial Catalog=" & Application.StartupPath & "\data.mdf;Integrated Security=True;"}

The program doesn't work, showing error : 40 - could not open a connection to SQL server.

Is there anyway simple to store data on a local database file in vbnet?

  • 1
    I always use SQL Server Compact Edition v4.0 in that kind of situation. You need to bundle a load of libraries with it, but it's pretty much standalone-in-a-folder otherwise. – Grim Aug 07 '14 at 14:22
  • 1
    Or, if you need stored procedure or triggers you could look at [LocalDB](http://stackoverflow.com/questions/9655362/localdb-deployment-on-client-pc) – Steve Aug 07 '14 at 14:23
  • possible duplicate of [Local database without sql server](http://stackoverflow.com/questions/4237849/local-database-without-sql-server) – Victor Zakharov Aug 07 '14 at 16:00

1 Answers1

0

You have a lot of options for local data, it really depends on what you are doing with it on what you want to do.

  • XML - You can create a DataSet and Read/Write XML (or binary) data to the HD
  • MS Access - I assume by your issue that you tried this but ran into an issue on a X64 machine. By default, x64 machines do not come with a x64 driver for MS Access. You have 2 choices, compile your app to x86 or install the x64 MS Access driver on the computer.
  • There are a lot of other small databases out there that require very little to NO install. I suggest you do some research if this is the way you want to go.
Steve
  • 5,585
  • 2
  • 18
  • 32