Web Hosting Talk







View Full Version : Asp.Net and MySql


Snargleflap
02-26-2009, 05:47 AM
I'm starting a document manager application that will be written in asp.net. The client has their own server and they don't have mssql, but they do have mysql installed, so I'll be using that.
I wanted to find out if there are any significant differences in using the 2 dbms's that I need to be aware of up front. The only remotely sophisticated feature of the app is that I'll be using a file upload and storing the file in the database rather than as separate files on the server. I've done this on mssql and it's basically a no brainer.
I have very little experience with mysql. In fact, the only thing I've ever done is pulled the most recent posts & comments from a wordpress database to display on my own page. I know the connection strings work fine, and normal select/insert logic works the same. I'm just looking to see if there's any "gotchas" I need to watch out for.
Thanks in advance.

Snargleflap
02-26-2009, 01:16 PM
Last night I set out to start the project. I did the following:
- Logged into my reseller account and created a new mysql db
- Used MySQL Administrator to create the new table and fields
- Downloaded and intstalled MySQL Connector/Net from MySQL
- Added a reference to it in my project
- Added a connection string for the db to web.config
- Used MySQL Administrator to add some test records to the table
- Threw a repeater on a page, coded a dbreader and bound it to the repeater
- After a little testing, I uploaded the page to my website
- Added the mysql dll to the bin folder
- Watched it work perfectly
The only small hiccup was an error because the date field in my test data was zero, which was resolved by adding a parameter to the connectionstring: ;Allow Zero Datetime=True;
Other than that, it was all as smooth as melted butter. The whole process took me just around an hour.

WebDevourer
02-26-2009, 05:53 PM
We used to store files in the mysql db and it became a nightmare to do backups as the database grew quite large. If you have a few files it may be ok but if you intend to store a large number of files or large files, you may face maintenance issues at a later time.
I usually prefer to keep files outside of the database. It is a personal preference though.

Snargleflap
02-26-2009, 06:25 PM
We used to store files in the mysql db and it became a nightmare to do backups as the database grew quite large. If you have a few files it may be ok but if you intend to store a large number of files or large files, you may face maintenance issues at a later time.
I usually prefer to keep files outside of the database. It is a personal preference though.
That's a good point, and one I hadn't thought about. It may not be a big issue though because there will be a smaller number of "how-to" type documents they upload that will be permanent. The rest of the stuff is going to be daily type reports that will age-out after 1-90 days and will be removed.
The client I'm building this for currently has a similar web-based report system where the reports are delivered from their mainframe via ftp, but they're just stored as pdf files in a folder on the server. So with that in mind, they're already dealing with backing all these files up.
Thanks for the heads-up, I'll discuss this with the client.