0

I am beginner of c# in vb.net. My question is where should I keep access databse to making database application. Because when I distribute it what I need to make global connection string that available client pc. client install in any drive so what I should do to complete the vb.net database application. please advice me step by step because I am beginner

Thanks in Advance Manish

  • Visual Basic .NET is a different language. Are you talking about C# in *Visual Studio* or are you actually talking about Visual Basic? – GeirGrusom Jul 22 '15 at 05:37
  • I made C# with Access in VB-2010 but when i distribute it My databse can not connect properly in client pc. I have keep my Access db in E: drive so any mistake occured i think at the time of distribute – manish joshi Jul 22 '15 at 05:40
  • So you have *Visual Studio* 2010, and you have a access database, but you are having issues with connecting to the access database. Usually you would just store the database either in the application folder (usually not recommended) or the application data folder: `System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "mydb.db")` which is specific for the current user. However does the client have Access installed? And is it the right version? – GeirGrusom Jul 22 '15 at 05:44
  • No client has not installed Access. So how can i ditribute – manish joshi Jul 22 '15 at 05:46
  • Could not find file 'E:\VB Project\C#\Transport\Transport\bin\Debug\System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Appl‌​icationData),Transportation.accdb)'. – manish joshi Jul 22 '15 at 06:02
  • when i compile error i found – manish joshi Jul 22 '15 at 06:03
  • I don't think I can help you any further. You are in way over your head. – GeirGrusom Jul 22 '15 at 06:19

1 Answers1

2

First thing first,

  1. If your client has not installed Access, you will either have to force him to install or distribute your system installer with embedded Microsoft Access Database Engine Redistributable which you can find on this link.

Microsoft Access Database Engine Redistributable usually provides you everything that you need for Access database usage for .NET

  1. You can always put your file in application directory. As GeirGrusom mentioned, it is not a good practice though. You can get the file path as shown in this link.
Community
  • 1
  • 1
jparthj
  • 1,606
  • 3
  • 20
  • 44
  • I don not understand properly. First I should keep my databse in:E:\VB Project\C#\Transport\Transport\bin\Debug then I sould give connection string as :System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Appl‌​icationData), "mydb.db") but there is already my databse file i seem so i dont understand. – manish joshi Jul 22 '15 at 07:49
  • Any walkthrough example link can anybody provide me – manish joshi Jul 22 '15 at 07:50
  • Your 'Debug' directory is your application directory if you are running from visual studio. So keep your database with executable file. Then get executing assembly path from the SO link i shared above. you will get the db path. Always use that path in your connection string. – jparthj Jul 22 '15 at 08:47