[.net] SQL question

Started by
6 comments, last by coolblue 17 years, 6 months ago
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.

Beginner in Game Development?  Read here. And read here.

 

Advertisement
Read these:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=765477&SiteID=1

http://www.mssqlcity.com/FAQ/General/check_sql_server_installed.htm

Cheers
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?

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

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.

Beginner in Game Development?  Read here. And read here.

 

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.
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.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

Surely an embedded database such as SQLite would be better for a game?

I'd only use an MSSQL database for the server.
You could use an xml datasource instead. That way it would be compatible with any computer.

This topic is closed to new replies.

Advertisement