Click here to Skip to main content
16,004,761 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey coders,

I have this SQL syntax to update the database from my main computer, but whenever I change computer, it just gives me the error that the database couldn't be found.

Is there any way to convert that big directory for the default directory of the application's folder?

In vb, to open database files I just needed to use ..\DATABASE.mdb

What I have tried:

SQL
backup database [C:\\Users\\centurion\\Desktop\\AcademiaSK\\AcademiaSK\\GMS_DB.mdf] to disk='" + destdir + "'with init,stats=10
Posted
Updated 28-Apr-17 6:28am

1 solution

YOU can, but you have to change from using SQL server to a "local" DB such as SqLite or Access - but even then, don't put the DB in the application folder: Where should I store my data?[^] explains why and shows how to use somewhere better.

But be aware that using a local database means you can't share it with others: if you need to do that, you need to stick with SQL server, and make your connection string configurable rather than hard coded (which is a damn good idea anyway).
 
Share this answer
 
Comments
Scribling Doodle 28-Apr-17 12:48pm    
MSSQL has any diference from those you said?
OriginalGriff 28-Apr-17 13:57pm    
MSSQL is another name for SQL Server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900