The code below is what you need to connect to a SQL Server CE .sdf file with classic ASP:
db.open "Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;Data Source=" & server.mappath("/App_Data/classicasp.sdf")
You can download a working sample for WebMatrix. Just unzip the file, right-click, and open it as a website in WebMatrix. Finally, click "Run" to run the sample.
This may not sound very sensational, but in reality, this is a very important piece of code. It's the key to start using WebMatrix in classic ASP. Classic ASP developers often used Microsoft Access databases so far (like we did in QuickerSite for many years - without major or even minor issues btw). Access databases were (and still are) very portable, compared to SQL Server databases. Now this new SQL Server Compact Edition (SQLServer CE) finally gives us another portable option (.sdf files).
That is how Classic ASP Developers can use WebMatrix as a full blown development environment, including database management, for FREE, and everything in 1 place. This is just great. When I developed QuickerSite, I needed at least 3 programs:
- Notepad ++ for the coding
- IIS for the websever
- Ms Access for the database
These 3 are now covered in 1 new tool by Microsoft: WebMatrix. This is amazing. Especially since WebMatrix runs fine on each and every recent Windows PC or Server. And it is now very easy to test-drive web applications. This is going to open a whole new world for those who never managed to run dynamic websites on their localhost.
This is only a beginning. I hope Microsoft will take the time to improve this WebMatrix product, but NOT overload it with features. We'll have to see about that I think :)