On Feb 8, 7:49 am, RayLopez99 wrote:
I figured out my problems, and just to complete this thread here are
the solutions:
1) you have to install SQL Server 2008 when working with Visual Studio
2008. That solved most of the problem #1.
2) as a bonus, I figured out a trick on how to use a relative path to
store your database, so that deploying it in a LAN is easy. From this
blog post (and it is undocumented):
http://www.develop-one.net/blog/2006/09/05/RelativePathInWebApplicatio...nnectio
The trick is this: using the term "=|DataDirectory|" will reference
the directory "App_Data" found in ASP.NET projects (and the
conventional place to put data).
So, suppose your database was called "myDatabase1", and your
Web.config file had this entry:
<connectionStrings>
<add name="myDataBaseConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename="C:\HardCodedDirectory
\myDataBase1.mdf";Integrated Security=True;Connect
Timeout=30;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
you would copy the database into your \App_Data folder found in the
app's root directory, then substitute this connection string (in
Web.config) to reference the database, which now resides under the
app's root directory, in \App_Data. Problem #2 solved, since no need
for an absolute file path, which is tricky in a LAN:
<connectionStrings>
<add name="myDataBaseConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename="|DataDirectory|
myDataBase1.mdf";Integrated Security=True;Connect Timeout=30;User
Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
RL
>> Stay informed about: Connection strings going from local drive to a network dri..