Sign in to follow this  
Alpha_ProgDes

[.net] SQL question

Recommended Posts

OK, what I want to do is have my C# app write to and save from a database. On my computer, I have SQL Server Express 2005. But what if the person has SQL Server: Standard, Professional, or Enterprise? What I'm hoping to do is have the program figure out what kind of SQL Server the target computer is running and then either connect to it or just download SQL Server Express if no databases are there. Is there a way to do this? If not, I guess I'll just stick to using a regular file to save and load data.

Share this post


Link to post
Share on other sites
Why do you not know what version of SQL Server you're app will be using? You're building the app, why aren't you specifying the data source?

Share this post


Link to post
Share on other sites
My application is going to use SQL Server EE because that's what I have on my computer. But if I wanted to give you the app to use and you had SQL Server Pro, then you shouldn't have to go and download SQL Server EE (that has happened to me by the way). So I want my app to detect if your computer has SQL Server on it and just connect my database files to your server if it does. If it doesn't have SQL Server at all, then it will download the SQL Server EE. If I am missing something (which it seems I am) please point in the right direction. Also, I'm not exactly proficient with C# and databases if you haven't already noticed.

Share this post


Link to post
Share on other sites
When distributing applications in this manner, you would normally have the user specify which database they have and how to connect to it. Usually this is done during installation. They will have to provide a password or the security of the database will be a problem.

Also, you will need to tell them which databases are acceptible to your application. There are differences in SQL syntax which your application will have to handle to make it work with different databases.

Forcing a download is also not a good idea. It could be a lengthy download and some firewalls may block it. It also could be a licensing issue. I'm not a lawyer, but you should check with one before going this route.

Share this post


Link to post
Share on other sites
Quote:
Original post by Alpha_ProgDes
My application is going to use SQL Server EE because that's what I have on my computer. But if I wanted to give you the app to use and you had SQL Server Pro, then you shouldn't have to go and download SQL Server EE (that has happened to me by the way). So I want my app to detect if your computer has SQL Server on it and just connect my database files to your server if it does. If it doesn't have SQL Server at all, then it will download the SQL Server EE. If I am missing something (which it seems I am) please point in the right direction. Also, I'm not exactly proficient with C# and databases if you haven't already noticed.

So are you also going to create the database you're using in the full SQL Server if that's what someone has? In the quick test I ran I couldn't attach an EE database to SQL Server 2000, so the database might have to be created manually and the data (if any) inserted. You can run a script to do this of course, but you have to be prepared to do so.

The one link that shows checking the registry seems to be a good solution for determing if SQL Server is installed and what version.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this