I have developped an app that previously used locally stored Access database on my computer and now I want to switch to SQL server on the provider's machine. However I'm not sure exactly how to do this. I didn't find any help of this sort that would help me with this. Any ideas?
Thanks a lot!
Jan
You need to change the using or imports statement from System.Data.OleDb to System.Data.SqlClient
Change all instances of OleDbConnection, OleDbCommand and OleDbDataAdapter to (respectively) SqlConnection, SqlCommand and SqlDataAdapter.
OleDb uses positional parameters, which are represented by ? characters in the SQL Strings, SqlClient uses named parameters.
Obviously, your connection string needs to be different. www.connectionstrings.com has examples, as does the MSDN documentation.
That should get you started.
I think I need to specify my problem a bit better. I managed to make my ASPX pages to connect to the SQL database (instead of to Access file), but the problem is with features like membership or web-parts. Those seem to store some information in the database, however on the new server they don't seem to know how to connect to the SQL server.
I thought this is set-up in the web.config file, but eve though I do have SQL server connection strings there it doesn't work for me.
I tried adding a new provider using the VS2005 Website/Asp.Net Configuration wizzard, but I don't have the option to Add provider there :-(
Thanks a lot for any help.
Jan
No comments:
Post a Comment