Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I'm new to C # but I did a project where I use localdb.
I have two questions that I need help
1º how to compile the project with an aggregated localdb database?
2nd
If migration is possible, is it better to use SqlLite to distribute the application?
thank you very much for any help

What I have tried:

nothing at this time because i dont know how to
Posted
Updated 25-Mar-21 9:08am
v2

"localdb" isn't a database, it's a "special" connection string that accesses the instance of SQL Server that is located in the same machine.

You don't include SQL databases "inside your app" by compiling it: you install an instance (or use an existing instance) and you access that. Your installation program should be responsible for do that, and creating any initial database if one doesn't exist already.

It's possible that you might get away with SqLite instead of SQL Server, but it depends on your app, your data, what you want to do with it, and how your code is written. If you expect only one user to ever access the DB, then you may get away with it. If multiple users are to access it simultaneously, then you need a multiuser DB like SQL server or MySql.
And your code will also feature heavily here: SqLite does not support everything SQL does - for example it doesn't support stored procedures - so if you are using features, they may not be present or will be very different.
 
Share this answer
 
Comments
miguel santos 2021 25-Mar-21 11:24am    
Thank you very much for the information.
As I already mentioned, I am a mere beginner im C # and sql so my request for help.
fi an application in C # in visual studio and for what it is intended it works perfectly with litebd,
litedb has sp, triggers and functions, so sqlLite will not be an option.
But I am tired of walking looking for how to compile the project and he installs the litedb and the backup of the "db" and I can't find anything and moreover some PCs do not accept the installation of the litedb 64 or 86x.
If you can help me or teach me how to overcome this, I am very grateful.
Maybe you can use a migration tool like dbMigration.NET, see:
best-relational-database-migration-tools[^]

You might also be interested in LiteDB as this is only a small dll that can easily be distributed with your application, see: best-databases-for-a-small-net-application[^]
 
Share this answer
 
v2
Comments
miguel santos 2021 27-Mar-21 3:25am    
thanks
Do you think, since you are new to C#, that creating an application that also requires a database (and even more so, two of them if you are going to migrate the data with your own code).

If new to programming, take baby steps. First, get comfortable with C#. You should also get comfortable with how a database works with applications.

Then - and only then - will you be able to write the code to do these things together. And finally, connect to more than one database at a time (if you really want to) and move the data.
 
Share this answer
 
Comments
miguel santos 2021 27-Mar-21 3:24am    
Thank you very much for the comment.
But for other responses I had, what is at issue at this moment is just to get that, when I compile for the project setup, to include the litedb as well as the db, because if you install the litedb and do the restore from the db the project works perfectly on any pc,
if you can teach me how to overcome this, I am immensely grateful.
thanks again for your patience

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