Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Hey hey guys!

Well, I had to make a vb app because I need it for some things. I connected the application to an SQL server database which allows me to get data from there. The problem here is that I want it to be installed in other computers. My database is local so what can I do? Do you have any ideia? 

Thanks and have a good day!


What I have tried:

I tried to use a local database using the option from visual studio but I am having some problems creating SQL server database file.
Posted
Updated 28-Apr-16 1:17am
Comments
Richard MacCutchan 28-Apr-16 6:59am    
You need SQL server installed on one system, and the client code in all the others. If you have problems then please edit your question and explain them in proper detail.
Member 12490691 28-Apr-16 7:06am    
But if I create the database file on Microsoft Visual Studio it's easier right?
Richard MacCutchan 28-Apr-16 7:09am    
Easier than what?

The database file is not the issue. The issue is that in order to share the database it needs to be controlled by an installation of SQL Server.
Member 12490691 28-Apr-16 7:16am    
I am making a data collection from every computer of the company that I'm working for. I want to get this data just for me you know what I mean?
Nigam,Ashish 28-Apr-16 7:09am    
where do you want to store data in local or in server?

1 solution

If you want a "local database" and it's only going to be used by a single user (i.e. you don't need multiple users accessing and altering the data at the same time) then you don't need an SQL Server database - you can use Access or SqLite instead, and they require little or no extra installation after .NET and your app is installed. You would have to change your application to use OleDbConnection, OleDbCommand (or SQLiteConnection, SQLiteCommand) objects instead of SqlConnection and SqlCommand and so forth, but that's normally a fairly trivial task.

If you do need multiuser access, then SQL Server needs to be installed and available on the network to all computers that run your application - on one PC per "group" of users, and they will need an appropriate connection string to access the server.

You can't "use an SQL database file" directly: you must go via SQL server, which requires full installation (and that is not a trivial job!)
 
Share this answer
 
Comments
Member 12490691 28-Apr-16 7:21am    
This local server will be just used by a single user(Me). What you're saying is that it's better if I create a Microsoft SQL Server Compact and change my code to allow it?
OriginalGriff 28-Apr-16 7:38am    
I wouldn't recommend SQL CE any more - it's pretty much end-of-life now, and you should probably use SQLite or Access instead.
Have a look at this extension:
https://visualstudiogallery.msdn.microsoft.com/0e313dfd-be80-4afb-b5e9-6e74d369f7a1
It lets you create SQLite DB's from within VS, including import from your existing SQL Server DB.
Member 12490691 28-Apr-16 8:43am    
I don't like Access so after I install it I should use which option?
-Microsoft ODBC Data Source?
OriginalGriff 28-Apr-16 8:58am    
Yes - ODBC for Access: OleDbConnection, OleDbCommand, and so forth in your app.
In all probability, you shouldn't need many other changes.
Member 12490691 28-Apr-16 9:09am    
There is another option instead of using Access database?

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