Monday, February 20, 2012

Microsoft SQL Server Management Studio Express

I am attempting to connect to a SQL Server 2005 database using a Visual
Studio.Net 2003 application.
When I use this connection string, I get a Keyword not supported: 'user
instance'. error.
<add key="SiteSqlServer" value="Data Source=.\SQLExpress;uid=sa;pwd=;User
Instance=True;AttachDBFilename=|DataDirectory|MyDB .mdf;Initial
Catalog=MyDB;" />
When I remove the "User Instance=True", I get a
Database 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\MyDB.mdf'
already exists. Could not attach file '|DataDirectory|MyDB.mdf' as database
'MyDB'.
What kind of connection string do I use and why doesn't VS2003 recognize the
"User Instance=True"?
See if this helps:
http://msdn.microsoft.com/sql/defaul...xpuserinst.asp
Andrew J. Kelly SQL MVP
"Nick K" <nospam@.hotmail.com> wrote in message
news:eT0gKC7DGHA.1032@.TK2MSFTNGP11.phx.gbl...
>I am attempting to connect to a SQL Server 2005 database using a Visual
> Studio.Net 2003 application.
> When I use this connection string, I get a Keyword not supported: 'user
> instance'. error.
> <add key="SiteSqlServer" value="Data Source=.\SQLExpress;uid=sa;pwd=;User
> Instance=True;AttachDBFilename=|DataDirectory|MyDB .mdf;Initial
> Catalog=MyDB;" />
> When I remove the "User Instance=True", I get a
> Database 'c:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\MyDB.mdf'
> already exists. Could not attach file '|DataDirectory|MyDB.mdf' as
> database
> 'MyDB'.
> What kind of connection string do I use and why doesn't VS2003 recognize
> the
> "User Instance=True"?
>
|||I read the document. I don't see an explanation of the "User Instance=True",
keyword not recognized error I am seeing. Is this because my SQLClient is
the .Net Framework 1.1? I'm currently using VS 2003
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23XxRkh7DGHA.796@.TK2MSFTNGP10.phx.gbl...
> See if this helps:
>
http://msdn.microsoft.com/sql/defaul...xpuserinst.asp[vbcol=seagreen]
>
> --
> Andrew J. Kelly SQL MVP
>
> "Nick K" <nospam@.hotmail.com> wrote in message
> news:eT0gKC7DGHA.1032@.TK2MSFTNGP11.phx.gbl...
Source=.\SQLExpress;uid=sa;pwd=;User
>
|||I think you should re-read the document again and make sure you understand
exactly what a "User Instance" really is. If you really want to use a User
Instance you can not use SQL Logins as stated in the document. If you don't
really want a User instance you connect just like any other connection to
SQL Server but you do not need to attach the files. This assumes you have
already loaded SQL Server on that machine. I am not sure if when using a
User Instance if you need the 2.0 client or not but I suspect you might.
Andrew J. Kelly SQL MVP
"Nick K" <nospam@.hotmail.com> wrote in message
news:%23Tn$rO8DGHA.2708@.TK2MSFTNGP11.phx.gbl...
>I read the document. I don't see an explanation of the "User
>Instance=True",
> keyword not recognized error I am seeing. Is this because my SQLClient is
> the .Net Framework 1.1? I'm currently using VS 2003
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:%23XxRkh7DGHA.796@.TK2MSFTNGP10.phx.gbl...
> http://msdn.microsoft.com/sql/defaul...xpuserinst.asp
> Source=.\SQLExpress;uid=sa;pwd=;User
>

No comments:

Post a Comment