Darrel said:
So...what do I do? How do I use my MDF file as my main DB and get
membership provider tables set up in it? Or should I not be using that? In
which case, how do I set up a DB in my local SQL server?
You do not use *.mdf file directly, SQL Server/Expresss does. You see
database list when connecting to SQL Server/Express, you do not see *.mdf
file.
When you use ASP.NET management wizard, it create a database on available
SQL Server or SQL Server Express. The *.mdf file is just database's file in
app_data folder. You do not deal with the file itself, SQL Server/Express
does. Once the database is created, you cannot touch the *.mdf file at all:
you canot copy/move/delete it.
However, there is a catch that make many new-bes confused when using SQL
Server Epxress, that is, SQL Server Express's USER INSTANCE. In this case,
the database based on the *.mdf file can be attach/detach to the SQL Server
Express when the application starts and end. Look at your connectionstring,
if there is something "AttachDBFile=..." and/or "User Instance=True", then
you are using SQL Server Express User Instance, which nost hosting services
would not support and you MUST make sure you DO understance what USER
INSTANCE is before using it.
Anyway, there is two ways for you to go ahead:
1. Just let the wizard do its job without knowing much what is going on
under the hood. You would for sure run into issues if you need to deploy
your website/project to other computer.
2. Thoroughly study SQL Server and Express before use it. As ASP.NET
developer working on MS platform, you need to this sooner or later anyway. I
see sound SQL Server knowledge as basic requirement for using it in
development. Once you know SQL Server well, then you can concentrate on how
to group uses, controls accessibilities. The easyiness of SQL Server based
membership provider is based on hard study of SQL Server.
I'm trying to accomplish what all of the video tutorials make appear easy.
Just make a few clicks in VS.net and you have your MDF file with all your
memebership provider data set up. Alas, I'm guessing those are all highly
edited tutorials and are missing 12 complex steps or so. ;o)
That easiness comes with price you should have paid previously: study SQL
Server.
If you know SQL Server well, then you can develop with SQL Server Express
and move to full SQL Server without single change. But remeber, USER
INSTANCE is SQL Server Express only feature, many ASP.NET book use it in
their sample code without much emphcise, assuming user has the SQL Server
knowledge, which confuses so many newbies, who post related question daily
here.
I'm positive the host will not support Express, however, I was under the
impression that it's not too difficult to develop locally with SQL express
and then just 'copy' the DB into a real SQL DB on the server. Fair
Once you know how SQL Server/Express works, you would know it is just a bit
more than copy/paste: you attach/detach, or back up/restore database from
one SQL Server to the other.
impression? That said, I'm finding it hard just to set up the Express DB
in the first place, so maybe I'm way underestimating the complexity of
this process.
Yes, study on SQL Server is due.