Jump to content
  • Advertisement
Sign in to follow this  
u235

[.net] Programatically altering database

This topic is 4502 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I found this code snippet on FreeVBcode.com about creating a database at runtime. There's no trouble with me understanding that, but I am having trouble finding resources on how to add rows/colums, etc. to the database programatically. I mean, really, what good is a blank database if you can't edit it, right? If anyone could point me to some resources on the topic I would be most appreciative. Thanks. -AJ

Share this post


Link to post
Share on other sites
Advertisement
You'll want to use a combination of sql statements and ado.net

Here are a couple of links to get you started.

http://samples.gotdotnet.com/quickstart/howto/
http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/UpdateDataFromDB.aspx

Share this post


Link to post
Share on other sites
Many thanks. Good info in the second one. Exactly what I was looking for [smile].

-AJ

Share this post


Link to post
Share on other sites
Probably not helpful to you (seems you're using Access?), but SQL Server has a full object model that lets you pretty much all the same things you can do from Management Studio. See f. ex. here for more info.

Share this post


Link to post
Share on other sites
First, thanks very much for the reply. I appreciate it. Actually, this is helpful to me because I'm not too sure at this point what kind of database I want to use and SQL is most certainly an option. That being said, what's the difference between the two, what kind of learning curves do they have, and any personal recommendations? I'm sorry for my lack of knowledge. I've never worked with databases and I don't know much about them except a general idea of how relational databases work. Thanks.

-AJ

Share this post


Link to post
Share on other sites
Well, SQL Server Express and SQL Server Express Management Studio are both free, so I don't really see a point in using a toy database like Access unless you really have to.

SQL Server:

* Full support for all common database functionality, like stored procedures, views (can Access do views?), triggers etc.
* Runs as a Windows service.
* Scales from small desktop applications to huge n-tier applications.
* Is fully supported by ADO.NET and other Microsoft data access technologies.
* Has a wide range of administration and tuning options (SMO as described above, SQL Server Management Studio, SQL Profiler)
* Great Visual Studio integration (sproc debugging, anyone?)

Access:

* Supports a limited subset of SQL (no stored procedures, no views).
* Scales from small desktop applications to small desktop applications.
* Lets you build applications directly using VBA.
* Databases are deployable as a single file, client does not need Access installed (however, if this is a requirement, I'd look into something like SQLite instead.

Share this post


Link to post
Share on other sites
Thanks very much for your insight and suggesstions. Right now, I'm just planning for something on a rather small scale, but it would be good to get to know something that I will be using for larger projects in the future. Using Access is tempting, though, due to it's apparent ease of use. Thanks again for the information.

-AJ

Share this post


Link to post
Share on other sites
Quote:
Original post by Arild Fines
Well, SQL Server Express and SQL Server Express Management Studio are both free, so I don't really see a point in using a toy database like Access unless you really have to.


I don't know... I consider being able to package an MDB file with the game/application as being a whole lot simpler than trying to

1. Determine if SQL Server Express is installed.
2. Obtain the authentication information from the end user, who probably has no clue what SQL Server Express is or that it's installed.
3. Determine if SQL Server Express is started and starting it, if I need to, or if it won't start trying to figure out why so I can give an intelligent error message to the end user.
4. Worry about the uninstallation of SQL Server Express or the instance of it I'm using being removed by a space or performance conscious user who doesn't realize it's required by my application.

The Jet database engine is included with MDAC which is included with Windows; if creating a Windows application you're guaranteed to have access to one version of Jet or another. The Access database might not be the most performant of the available options but I do consider it the safest and most reliable.

As well I believe that SQL Server Express has limited redistribution rights (read: none) requiring installation by the end user without separate licensing from Microsoft. (I could be wrong in this regard; I only have SQL Server 2000 Developer's Edition on my machine here and Microsoft's licensing terms for specific software are difficult to find unless you install it.)

If performance is an issue - i.e. you're writing an application which will make heavy use of database features - definitely use SQL Server Express because it will make Access look like a chihuahua in a greyhound race.

Share this post


Link to post
Share on other sites
Quote:
Original post by Talonius
Quote:
Original post by Arild Fines
Well, SQL Server Express and SQL Server Express Management Studio are both free, so I don't really see a point in using a toy database like Access unless you really have to.


I don't know... I consider being able to package an MDB file with the game/application as being a whole lot simpler than trying to...

That goes under "unless you really have to". Besides, I'd still pick SQLite over Access for the kind of deployment scenario you describe.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!