Home All Groups Group Topic Archive Search About
Author
8 Jan 2007 4:07 AM
Jonathan Wood
Grrr...

I've spent the last several hours trying to learn ADO.NET. Specifically, the
database connection stuff.

I finally managed to create a database and enter some data within the VS
IDE. I have several ADO.NET books but not one could tell me how to set up my
password.

To make a long story short, I ended up setting up a connection using
(local)\SQLEXPRESS since that's what the only example I could find uses and
I have no idea what to enter for regular MS SQL.

But I didn't have a change to enter a password or anything like that. Based
on another book, I tried all of the following:

string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;Integrated Security=True";
string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;Integrated Security=SSPI";
string connString = "Data Source=localhost;Initial
Catalog=BlackBeltCoder;user id=sa;password=opensesame";

SqlConnection conn = new SqlConnection(connString);
conn.Open();

In each case, the code fails on the call to Open(). Here's the message I
get:

"An error has occurred while establishing a connection to the server.  When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)"

Well, that's very helpful. I'm not using a remote connection.

I'm running my Web site in the IDE and will still need to figure out how to
connect to the database once I copy the site to my Web hosting account but I
can only deal with so much pain at once.

Is there any help available to figure out how to connect to the database I
have connected?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Author
8 Jan 2007 5:30 AM
RobinS
Are you trying to connect to SQLServer? Or SQLServer Express?

Robin S.
-----------------------
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
> Grrr...
>
> I've spent the last several hours trying to learn ADO.NET.
> Specifically, the database connection stuff.
>
> I finally managed to create a database and enter some data within the
> VS IDE. I have several ADO.NET books but not one could tell me how to
> set up my password.
>
> To make a long story short, I ended up setting up a connection using
> (local)\SQLEXPRESS since that's what the only example I could find
> uses and I have no idea what to enter for regular MS SQL.
>
> But I didn't have a change to enter a password or anything like that.
> Based on another book, I tried all of the following:
>
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;Integrated Security=True";
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;Integrated Security=SSPI";
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>
> SqlConnection conn = new SqlConnection(connString);
> conn.Open();
>
> In each case, the code fails on the call to Open(). Here's the message
> I get:
>
> "An error has occurred while establishing a connection to the server.
> When connecting to SQL Server 2005, this failure may be caused by the
> fact that under the default settings SQL Server does not allow remote
> connections. (provider: Named Pipes Provider, error: 40 - Could not
> open a connection to SQL Server)"
>
> Well, that's very helpful. I'm not using a remote connection.
>
> I'm running my Web site in the IDE and will still need to figure out
> how to connect to the database once I copy the site to my Web hosting
> account but I can only deal with so much pain at once.
>
> Is there any help available to figure out how to connect to the
> database I have connected?
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
8 Jan 2007 6:24 PM
Jonathan Wood
Good question.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Show quote
"RobinS" <RobinS@NoSpam.yah.none> wrote in message
news:nsmdnTnaiol8SzzYnZ2dnUVZ_umlnZ2d@comcast.com...
> Are you trying to connect to SQLServer? Or SQLServer Express?
>
> Robin S.
> -----------------------
> "Jonathan Wood" <jw***@softcircuits.com> wrote in message
> news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
>> Grrr...
>>
>> I've spent the last several hours trying to learn ADO.NET. Specifically,
>> the database connection stuff.
>>
>> I finally managed to create a database and enter some data within the VS
>> IDE. I have several ADO.NET books but not one could tell me how to set up
>> my password.
>>
>> To make a long story short, I ended up setting up a connection using
>> (local)\SQLEXPRESS since that's what the only example I could find uses
>> and I have no idea what to enter for regular MS SQL.
>>
>> But I didn't have a change to enter a password or anything like that.
>> Based on another book, I tried all of the following:
>>
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;Integrated Security=True";
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;Integrated Security=SSPI";
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>>
>> SqlConnection conn = new SqlConnection(connString);
>> conn.Open();
>>
>> In each case, the code fails on the call to Open(). Here's the message I
>> get:
>>
>> "An error has occurred while establishing a connection to the server.
>> When connecting to SQL Server 2005, this failure may be caused by the
>> fact that under the default settings SQL Server does not allow remote
>> connections. (provider: Named Pipes Provider, error: 40 - Could not open
>> a connection to SQL Server)"
>>
>> Well, that's very helpful. I'm not using a remote connection.
>>
>> I'm running my Web site in the IDE and will still need to figure out how
>> to connect to the database once I copy the site to my Web hosting account
>> but I can only deal with so much pain at once.
>>
>> Is there any help available to figure out how to connect to the database
>> I have connected?
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>>
>
>
Author
8 Jan 2007 6:54 PM
RobinS
I'm not sure what that means. Does that mean you don't know?
You said in another post you were trying to figure out
which technical option you wanted.

The reason I asked is because I had this problem with SQLServer
running on my laptop, and figured out how to fix it. I don't
know if it will fix the problem in SQLServer Express, though.

The problem is that the database is not set to accept remote
connections. I searched MSDN on the exact error message, and
found only one article about it, and it fixed my problem.
(THAT's a first!)

I opened the Surface Area Configuration utility,
selected Services & Connections,
clicked on Remote Connections under Database Engine,
selected "Local and Remote connections"
and set "Using both TCP/IP and Named Pipes" to true.

How you get there from SQLServer Express, I don't know.

I usually use integrated security, which means I use the
Windows username and password. This means there is no password
hardcoded anywhere that someone can find.

I hope this helps in some way.
Robin S.
-------------------------------------
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:%23%23m1WJ1MHHA.1280@TK2MSFTNGP04.phx.gbl...
> Good question.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
> "RobinS" <RobinS@NoSpam.yah.none> wrote in message
> news:nsmdnTnaiol8SzzYnZ2dnUVZ_umlnZ2d@comcast.com...
>> Are you trying to connect to SQLServer? Or SQLServer Express?
>>
>> Robin S.
>> -----------------------
>> "Jonathan Wood" <jw***@softcircuits.com> wrote in message
>> news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
>>> Grrr...
>>>
>>> I've spent the last several hours trying to learn ADO.NET.
>>> Specifically, the database connection stuff.
>>>
>>> I finally managed to create a database and enter some data within
>>> the VS IDE. I have several ADO.NET books but not one could tell me
>>> how to set up my password.
>>>
>>> To make a long story short, I ended up setting up a connection using
>>> (local)\SQLEXPRESS since that's what the only example I could find
>>> uses and I have no idea what to enter for regular MS SQL.
>>>
>>> But I didn't have a change to enter a password or anything like
>>> that. Based on another book, I tried all of the following:
>>>
>>> string connString = "Data Source=localhost;Initial
>>> Catalog=BlackBeltCoder;Integrated Security=True";
>>> string connString = "Data Source=localhost;Initial
>>> Catalog=BlackBeltCoder;Integrated Security=SSPI";
>>> string connString = "Data Source=localhost;Initial
>>> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>>>
>>> SqlConnection conn = new SqlConnection(connString);
>>> conn.Open();
>>>
>>> In each case, the code fails on the call to Open(). Here's the
>>> message I get:
>>>
>>> "An error has occurred while establishing a connection to the
>>> server. When connecting to SQL Server 2005, this failure may be
>>> caused by the fact that under the default settings SQL Server does
>>> not allow remote connections. (provider: Named Pipes Provider,
>>> error: 40 - Could not open a connection to SQL Server)"
>>>
>>> Well, that's very helpful. I'm not using a remote connection.
>>>
>>> I'm running my Web site in the IDE and will still need to figure out
>>> how to connect to the database once I copy the site to my Web
>>> hosting account but I can only deal with so much pain at once.
>>>
>>> Is there any help available to figure out how to connect to the
>>> database I have connected?
>>>
>>> --
>>> Jonathan Wood
>>> SoftCircuits Programming
>>> http://www.softcircuits.com
>>>
>>>
>>
>>
>
>
Author
8 Jan 2007 7:09 PM
Jonathan Wood
Robin,

> I'm not sure what that means. Does that mean you don't know?
> You said in another post you were trying to figure out
> which technical option you wanted.

Yes, it means that I do not know. And, yes, I'm trying to figure out which
technical options I "want".

> The reason I asked is because I had this problem with SQLServer
> running on my laptop, and figured out how to fix it. I don't
> know if it will fix the problem in SQLServer Express, though.

I doubt it. My issue is more of a (which should be) basic issues I'm trying
to learn, and not more of a problem with a particular computer.

Show quote
> The problem is that the database is not set to accept remote
> connections. I searched MSDN on the exact error message, and
> found only one article about it, and it fixed my problem.
> (THAT's a first!)
>
> I opened the Surface Area Configuration utility,
> selected Services & Connections,
> clicked on Remote Connections under Database Engine,
> selected "Local and Remote connections"
> and set "Using both TCP/IP and Named Pipes" to true.
>
> How you get there from SQLServer Express, I don't know.
>
> I usually use integrated security, which means I use the
> Windows username and password. This means there is no password
> hardcoded anywhere that someone can find.
>
> I hope this helps in some way.

First off, I have a hunch I'm not using SQL Server Express (based on the
fact that none of the software I installed was an Express Edition) ????

Second, I'm confused by the term remote connection. Isn't that related to
when you connect to a database that is located on another computer?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
8 Jan 2007 8:22 PM
RobinS
If you installed it, and didn't pay big money for it, it's
probably SQLServer Express. I believe when you install Visual
Studio 2005, it gives you the option to install SQLServer Express.
So the big question is how did you install it, and do you
have the original media?

Also, if you have the real deal, you can do Start/Programs/
MicrosoftSQLServer2005/... and you'll have a bunch of options.

As for the remote connection thing, I don't understand it
either, because I'm running the real deal on my laptop
along with VS2005, so I don't think of that as "remote",
but apparently SQLServer does. Maybe it thinks of remote
connections as anything connecting to the server, rather
than running queries by running something inside SQLServer
from the Query Analyzer or the Management Studio. That would
be my guess.

Robin S.
--------------------

Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:%23$uvYi1MHHA.4384@TK2MSFTNGP03.phx.gbl...
> Robin,
>
>> I'm not sure what that means. Does that mean you don't know?
>> You said in another post you were trying to figure out
>> which technical option you wanted.
>
> Yes, it means that I do not know. And, yes, I'm trying to figure out
> which technical options I "want".
>
>> The reason I asked is because I had this problem with SQLServer
>> running on my laptop, and figured out how to fix it. I don't
>> know if it will fix the problem in SQLServer Express, though.
>
> I doubt it. My issue is more of a (which should be) basic issues I'm
> trying to learn, and not more of a problem with a particular computer.
>
>> The problem is that the database is not set to accept remote
>> connections. I searched MSDN on the exact error message, and
>> found only one article about it, and it fixed my problem.
>> (THAT's a first!)
>>
>> I opened the Surface Area Configuration utility,
>> selected Services & Connections,
>> clicked on Remote Connections under Database Engine,
>> selected "Local and Remote connections"
>> and set "Using both TCP/IP and Named Pipes" to true.
>>
>> How you get there from SQLServer Express, I don't know.
>>
>> I usually use integrated security, which means I use the
>> Windows username and password. This means there is no password
>> hardcoded anywhere that someone can find.
>>
>> I hope this helps in some way.
>
> First off, I have a hunch I'm not using SQL Server Express (based on
> the fact that none of the software I installed was an Express Edition)
> ????
>
> Second, I'm confused by the term remote connection. Isn't that related
> to when you connect to a database that is located on another computer?
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
8 Jan 2007 8:30 PM
Jonathan Wood
Robin,

> If you installed it, and didn't pay big money for it, it's
> probably SQLServer Express. I believe when you install Visual
> Studio 2005, it gives you the option to install SQLServer Express.
> So the big question is how did you install it, and do you
> have the original media?

I simply cannot believe there is no way to tell the difference without
remembering every option selected during the initial installation. All I
remember is that I had to install some SQL server software for VS 2003, and
that I read it was not needed when I installed VS 2005. Either way, I am not
going to be able to tell you which installation options were selected
exactly.

> Also, if you have the real deal, you can do Start/Programs/
> MicrosoftSQLServer2005/... and you'll have a bunch of options.

I do have a Microsoft SQL Server 2005 options in my All Programs menu.

> As for the remote connection thing, I don't understand it
> either, because I'm running the real deal on my laptop
> along with VS2005, so I don't think of that as "remote",
> but apparently SQLServer does. Maybe it thinks of remote
> connections as anything connecting to the server, rather
> than running queries by running something inside SQLServer
> from the Query Analyzer or the Management Studio. That would
> be my guess.

Sounds right. Now all I need to do is figure out what to do about it.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
8 Jan 2007 5:50 AM
Cor Ligthert [MVP]
Johanthan,

We all try to learn on this board, will you next time the name of books you
have used as well.

Thank you for informing us that we have to watch this when we buy books
about AdoNet.

Cor


Show quote
"Jonathan Wood" <jw***@softcircuits.com> schreef in bericht
news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
> Grrr...
>
> I've spent the last several hours trying to learn ADO.NET. Specifically,
> the database connection stuff.
>
> I finally managed to create a database and enter some data within the VS
> IDE. I have several ADO.NET books but not one could tell me how to set up
> my password.
>
> To make a long story short, I ended up setting up a connection using
> (local)\SQLEXPRESS since that's what the only example I could find uses
> and I have no idea what to enter for regular MS SQL.
>
> But I didn't have a change to enter a password or anything like that.
> Based on another book, I tried all of the following:
>
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;Integrated Security=True";
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;Integrated Security=SSPI";
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>
> SqlConnection conn = new SqlConnection(connString);
> conn.Open();
>
> In each case, the code fails on the call to Open(). Here's the message I
> get:
>
> "An error has occurred while establishing a connection to the server.
> When connecting to SQL Server 2005, this failure may be caused by the fact
> that under the default settings SQL Server does not allow remote
> connections. (provider: Named Pipes Provider, error: 40 - Could not open a
> connection to SQL Server)"
>
> Well, that's very helpful. I'm not using a remote connection.
>
> I'm running my Web site in the IDE and will still need to figure out how
> to connect to the database once I copy the site to my Web hosting account
> but I can only deal with so much pain at once.
>
> Is there any help available to figure out how to connect to the database I
> have connected?
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
8 Jan 2007 6:48 PM
RobinS
I hardly think it's the fault of the books on ADO. I can
understand how they would think you know your own username
and password in SQLServer.

Now , if it was a book on SQLServer, that might be a
different issue.

Robin S.
--------------------------
Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:edejNiuMHHA.420@TK2MSFTNGP06.phx.gbl...
> Johanthan,
>
> We all try to learn on this board, will you next time the name of
> books you have used as well.
>
> Thank you for informing us that we have to watch this when we buy
> books about AdoNet.
>
> Cor
>
>
> "Jonathan Wood" <jw***@softcircuits.com> schreef in bericht
> news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
>> Grrr...
>>
>> I've spent the last several hours trying to learn ADO.NET.
>> Specifically, the database connection stuff.
>>
>> I finally managed to create a database and enter some data within the
>> VS IDE. I have several ADO.NET books but not one could tell me how to
>> set up my password.
>>
>> To make a long story short, I ended up setting up a connection using
>> (local)\SQLEXPRESS since that's what the only example I could find
>> uses and I have no idea what to enter for regular MS SQL.
>>
>> But I didn't have a change to enter a password or anything like that.
>> Based on another book, I tried all of the following:
>>
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;Integrated Security=True";
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;Integrated Security=SSPI";
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>>
>> SqlConnection conn = new SqlConnection(connString);
>> conn.Open();
>>
>> In each case, the code fails on the call to Open(). Here's the
>> message I get:
>>
>> "An error has occurred while establishing a connection to the server.
>> When connecting to SQL Server 2005, this failure may be caused by the
>> fact that under the default settings SQL Server does not allow remote
>> connections. (provider: Named Pipes Provider, error: 40 - Could not
>> open a connection to SQL Server)"
>>
>> Well, that's very helpful. I'm not using a remote connection.
>>
>> I'm running my Web site in the IDE and will still need to figure out
>> how to connect to the database once I copy the site to my Web hosting
>> account but I can only deal with so much pain at once.
>>
>> Is there any help available to figure out how to connect to the
>> database I have connected?
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>>
>
>
Author
8 Jan 2007 7:11 PM
Jonathan Wood
"RobinS" <RobinS@NoSpam.yah.none> wrote in message
news:SbGdndray_KFDz_YnZ2dnUVZ_ualnZ2d@comcast.com...
>I hardly think it's the fault of the books on ADO. I can
> understand how they would think you know your own username
> and password in SQLServer.

So is that what it's asking me? The user name and password to my computer?
If so, that would be at least one new thing I've learned. That is not
obvious to me at all. And, of course, begs the question as to what they'll
be on my host server.

Show quote
>
> Now , if it was a book on SQLServer, that might be a
> different issue.
>
> Robin S.
> --------------------------
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:edejNiuMHHA.420@TK2MSFTNGP06.phx.gbl...
>> Johanthan,
>>
>> We all try to learn on this board, will you next time the name of books
>> you have used as well.
>>
>> Thank you for informing us that we have to watch this when we buy books
>> about AdoNet.
>>
>> Cor
>>
>>
>> "Jonathan Wood" <jw***@softcircuits.com> schreef in bericht
>> news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
>>> Grrr...
>>>
>>> I've spent the last several hours trying to learn ADO.NET. Specifically,
>>> the database connection stuff.
>>>
>>> I finally managed to create a database and enter some data within the VS
>>> IDE. I have several ADO.NET books but not one could tell me how to set
>>> up my password.
>>>
>>> To make a long story short, I ended up setting up a connection using
>>> (local)\SQLEXPRESS since that's what the only example I could find uses
>>> and I have no idea what to enter for regular MS SQL.
>>>
>>> But I didn't have a change to enter a password or anything like that.
>>> Based on another book, I tried all of the following:
>>>
>>> string connString = "Data Source=localhost;Initial
>>> Catalog=BlackBeltCoder;Integrated Security=True";
>>> string connString = "Data Source=localhost;Initial
>>> Catalog=BlackBeltCoder;Integrated Security=SSPI";
>>> string connString = "Data Source=localhost;Initial
>>> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>>>
>>> SqlConnection conn = new SqlConnection(connString);
>>> conn.Open();
>>>
>>> In each case, the code fails on the call to Open(). Here's the message I
>>> get:
>>>
>>> "An error has occurred while establishing a connection to the server.
>>> When connecting to SQL Server 2005, this failure may be caused by the
>>> fact that under the default settings SQL Server does not allow remote
>>> connections. (provider: Named Pipes Provider, error: 40 - Could not open
>>> a connection to SQL Server)"
>>>
>>> Well, that's very helpful. I'm not using a remote connection.
>>>
>>> I'm running my Web site in the IDE and will still need to figure out how
>>> to connect to the database once I copy the site to my Web hosting
>>> account but I can only deal with so much pain at once.
>>>
>>> Is there any help available to figure out how to connect to the database
>>> I have connected?
>>>
>>> --
>>> Jonathan Wood
>>> SoftCircuits Programming
>>> http://www.softcircuits.com
>>>
>>>
>>
>>
>
>
Author
8 Jan 2007 8:31 PM
RobinS
Where is it asking you for the username and password? Because
if I use integrated security, it doesn't ask me, it collects
that information from Windows.

Here's an example of connection string I'm using:

Data Source=xMyMachineName\xMySQLServerName;Initial
  Catalog=myFavoriteDB;Integrated Security=True

If you have SQLServerExpress installed, the default
name is the computer name with \SQLExpress appended to it.
To find your computer name, right-click on My Computer
and choose the tab "Computer Name".

To create a SQLServer database using Server Explorer in VS2005:

Click on View/ServerExplorer.

Right-click on the Data Connections node and select
  Create New SQL Server Database from the context menu.
  This displays the Create New SQL Server Database dialog.

Select the name of the SQL Server you want to use.
  You may not see your SQLServer Express edition appear
  in the list. If yot, you can type it in as <your machine
  name>\SQLExpress or as (local)\SQLExpress or just .\SQLExpress.

Define the appropriate info to log into the selected SQL Server.
  By default, SQL Server Express is installed with Windows
  Authenticaion in place.

Define the name of the database.

Click <OK>.

After it's in the Server Explorer, you can create tables
in the database, add data, create stored procedures, etc.

Does this work for you?

Robin S.
-------------------------------

Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:OUEkkj1MHHA.5064@TK2MSFTNGP04.phx.gbl...
> "RobinS" <RobinS@NoSpam.yah.none> wrote in message
> news:SbGdndray_KFDz_YnZ2dnUVZ_ualnZ2d@comcast.com...
>>I hardly think it's the fault of the books on ADO. I can
>> understand how they would think you know your own username
>> and password in SQLServer.
>
> So is that what it's asking me? The user name and password to my
> computer? If so, that would be at least one new thing I've learned.
> That is not obvious to me at all. And, of course, begs the question as
> to what they'll be on my host server.
>
>>
>> Now , if it was a book on SQLServer, that might be a
>> different issue.
>>
>> Robin S.
>> --------------------------
>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
>> news:edejNiuMHHA.420@TK2MSFTNGP06.phx.gbl...
>>> Johanthan,
>>>
>>> We all try to learn on this board, will you next time the name of
>>> books you have used as well.
>>>
>>> Thank you for informing us that we have to watch this when we buy
>>> books about AdoNet.
>>>
>>> Cor
>>>
>>>
>>> "Jonathan Wood" <jw***@softcircuits.com> schreef in bericht
>>> news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
>>>> Grrr...
>>>>
>>>> I've spent the last several hours trying to learn ADO.NET.
>>>> Specifically, the database connection stuff.
>>>>
>>>> I finally managed to create a database and enter some data within
>>>> the VS IDE. I have several ADO.NET books but not one could tell me
>>>> how to set up my password.
>>>>
>>>> To make a long story short, I ended up setting up a connection
>>>> using (local)\SQLEXPRESS since that's what the only example I could
>>>> find uses and I have no idea what to enter for regular MS SQL.
>>>>
>>>> But I didn't have a change to enter a password or anything like
>>>> that. Based on another book, I tried all of the following:
>>>>
>>>> string connString = "Data Source=localhost;Initial
>>>> Catalog=BlackBeltCoder;Integrated Security=True";
>>>> string connString = "Data Source=localhost;Initial
>>>> Catalog=BlackBeltCoder;Integrated Security=SSPI";
>>>> string connString = "Data Source=localhost;Initial
>>>> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>>>>
>>>> SqlConnection conn = new SqlConnection(connString);
>>>> conn.Open();
>>>>
>>>> In each case, the code fails on the call to Open(). Here's the
>>>> message I get:
>>>>
>>>> "An error has occurred while establishing a connection to the
>>>> server. When connecting to SQL Server 2005, this failure may be
>>>> caused by the fact that under the default settings SQL Server does
>>>> not allow remote connections. (provider: Named Pipes Provider,
>>>> error: 40 - Could not open a connection to SQL Server)"
>>>>
>>>> Well, that's very helpful. I'm not using a remote connection.
>>>>
>>>> I'm running my Web site in the IDE and will still need to figure
>>>> out how to connect to the database once I copy the site to my Web
>>>> hosting account but I can only deal with so much pain at once.
>>>>
>>>> Is there any help available to figure out how to connect to the
>>>> database I have connected?
>>>>
>>>> --
>>>> Jonathan Wood
>>>> SoftCircuits Programming
>>>> http://www.softcircuits.com
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
8 Jan 2007 8:49 PM
Jonathan Wood
Robin,

> Where is it asking you for the username and password? Because
> if I use integrated security, it doesn't ask me, it collects
> that information from Windows.

It isn't. However, the connection string can include a user name and
password, and it appears the connection string is where I'm currently hung
up.

> Here's an example of connection string I'm using:
>
> Data Source=xMyMachineName\xMySQLServerName;Initial
>  Catalog=myFavoriteDB;Integrated Security=True

And, here again, are the ones I tried:

"Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
Security=True"
"Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
Security=SSPI"
"Data Source=localhost;Initial Catalog=BlackBeltCoder;user
id=sa;password=opensesame"

The password in the last one I read was the default.

> If you have SQLServerExpress installed, the default
> name is the computer name with \SQLExpress appended to it.
> To find your computer name, right-click on My Computer
> and choose the tab "Computer Name".

Where is this? Is this the Data Source value in the connection string or
something else?

Show quote
> To create a SQLServer database using Server Explorer in VS2005:
>
> Click on View/ServerExplorer.
>
> Right-click on the Data Connections node and select
>  Create New SQL Server Database from the context menu.
>  This displays the Create New SQL Server Database dialog.
>
> Select the name of the SQL Server you want to use.
>  You may not see your SQLServer Express edition appear
>  in the list. If yot, you can type it in as <your machine
>  name>\SQLExpress or as (local)\SQLExpress or just .\SQLExpress.
>
> Define the appropriate info to log into the selected SQL Server.
>  By default, SQL Server Express is installed with Windows
>  Authenticaion in place.
>
> Define the name of the database.
>
> Click <OK>.

I'm happy to try this (I haven't yet). In fact, I'm printing this out.

However, am I screwed given that I already created a database? What would be
*really* nice is if I could see my settings for the database I created and
then change them. But, alas, that's probably too simple, eh?

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
9 Jan 2007 12:44 AM
RobinS
Look for *** below.
Robin S.
----------------------------------
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:utzIia2MHHA.1240@TK2MSFTNGP03.phx.gbl...
> Robin,
>
>> Where is it asking you for the username and password? Because
>> if I use integrated security, it doesn't ask me, it collects
>> that information from Windows.
>
> It isn't. However, the connection string can include a user name and
> password, and it appears the connection string is where I'm currently
> hung up.
>
>> Here's an example of connection string I'm using:
>>
>> Data Source=xMyMachineName\xMySQLServerName;Initial
>>  Catalog=myFavoriteDB;Integrated Security=True
>
> And, here again, are the ones I tried:
>
> "Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
> Security=True"

*** I would use this one, but you need \sqlservername after
    localhost.

Show quote
> "Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
> Security=SSPI"
> "Data Source=localhost;Initial Catalog=BlackBeltCoder;user
> id=sa;password=opensesame"
>
> The password in the last one I read was the default.
>
>> If you have SQLServerExpress installed, the default
>> name is the computer name with \SQLExpress appended to it.
>> To find your computer name, right-click on My Computer
>> and choose the tab "Computer Name".
>
> Where is this? Is this the Data Source value in the connection string
> or something else?

You can put your computer name in, instead of using "localhost".

Show quote
>
>> To create a SQLServer database using Server Explorer in VS2005:
>>
>> Click on View/ServerExplorer.
>>
>> Right-click on the Data Connections node and select
>>  Create New SQL Server Database from the context menu.
>>  This displays the Create New SQL Server Database dialog.
>>
>> Select the name of the SQL Server you want to use.
>>  You may not see your SQLServer Express edition appear
>>  in the list. If yot, you can type it in as <your machine
>>  name>\SQLExpress or as (local)\SQLExpress or just .\SQLExpress.
>>
>> Define the appropriate info to log into the selected SQL Server.
>>  By default, SQL Server Express is installed with Windows
>>  Authenticaion in place.
>>
>> Define the name of the database.
>>
>> Click <OK>.
>
> I'm happy to try this (I haven't yet). In fact, I'm printing this out.
>
> However, am I screwed given that I already created a database? What
> would be *really* nice is if I could see my settings for the database
> I created and then change them. But, alas, that's probably too simple,
> eh?

No, I'm just trying to get you connected at all. Once you've connected
VS2005 to your SQLServer instance, you should be able to connect to
and/or see all of the databases therein.

>
> Thanks.
> Jonathan Wood

Good luck.
Robin S.
Author
9 Jan 2007 2:13 AM
Jonathan Wood
Robin,

> No, I'm just trying to get you connected at all. Once you've connected
> VS2005 to your SQLServer instance, you should be able to connect to
> and/or see all of the databases therein.

I'm already able to see all other databases within the IDE (although I
deleted them all today except for the one I'm working with).

I am up and running on my test machine so I appreciate that. I still say
this seems wwwwwwwaaaaaaaaaaaayyyyyyy more complicated than it seems it
needs to be. And it scares me knowing I'll have to start from scratch when I
want to get it running on my Web site server.

I've saved some notes from these conversations. We'll see what happens.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
9 Jan 2007 3:12 AM
RobinS
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:%23b0$UP5MHHA.992@TK2MSFTNGP04.phx.gbl...
> Robin,
>
>> No, I'm just trying to get you connected at all. Once you've
>> connected
>> VS2005 to your SQLServer instance, you should be able to connect to
>> and/or see all of the databases therein.
>
> I'm already able to see all other databases within the IDE (although I
> deleted them all today except for the one I'm working with).
>
> I am up and running on my test machine so I appreciate that. I still
> say this seems wwwwwwwaaaaaaaaaaaayyyyyyy more complicated than it
> seems it needs to be. And it scares me knowing I'll have to start from
> scratch when I want to get it running on my Web site server.
>
> I've saved some notes from these conversations. We'll see what
> happens.
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>

I was going to say, "It's always easier the second time",
but I've decided I don't want to give you false hope.  ;-)

It's not as complicated as you think it is; once it makes
sense to you, it'll be easier. At least, that's *my* theory.

Good luck.
Robin S.
Author
9 Jan 2007 3:58 AM
Jonathan Wood
Robin,

> I was going to say, "It's always easier the second time",
> but I've decided I don't want to give you false hope.  ;-)
>
> It's not as complicated as you think it is; once it makes
> sense to you, it'll be easier. At least, that's *my* theory.

Everything is easier when you've figured it out. It's the figuring out that
can be hard. <g>

> I think he's referring to the MacDonald book you already have.
> I was thinking about buying the VB version, and now that I know
> Bill thinks it's a good book, I probably will.

That was Mathew MacDonald I was talking about. Not sure about the Rob.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
9 Jan 2007 4:05 AM
William (Bill) Vaughn
OOOPS. Did you try to delete Master, Model and TempDB? If you did, you're
pooched.
These databases are used to manage/support all of the others.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:%23b0$UP5MHHA.992@TK2MSFTNGP04.phx.gbl...
> Robin,
>
>> No, I'm just trying to get you connected at all. Once you've connected
>> VS2005 to your SQLServer instance, you should be able to connect to
>> and/or see all of the databases therein.
>
> I'm already able to see all other databases within the IDE (although I
> deleted them all today except for the one I'm working with).
>
> I am up and running on my test machine so I appreciate that. I still say
> this seems wwwwwwwaaaaaaaaaaaayyyyyyy more complicated than it seems it
> needs to be. And it scares me knowing I'll have to start from scratch when
> I want to get it running on my Web site server.
>
> I've saved some notes from these conversations. We'll see what happens.
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
9 Jan 2007 5:34 AM
Jonathan Wood
Uh, I don't think I saw anything like that. It seemed like they were all
databases I created.

Note that I deleted these under Data Connections in the Server Explorer (VS
2005). Everything seems to be working okay.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
news:OTmPcN6MHHA.4376@TK2MSFTNGP03.phx.gbl...
> OOOPS. Did you try to delete Master, Model and TempDB? If you did, you're
> pooched.
> These databases are used to manage/support all of the others.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
>
> "Jonathan Wood" <jw***@softcircuits.com> wrote in message
> news:%23b0$UP5MHHA.992@TK2MSFTNGP04.phx.gbl...
>> Robin,
>>
>>> No, I'm just trying to get you connected at all. Once you've connected
>>> VS2005 to your SQLServer instance, you should be able to connect to
>>> and/or see all of the databases therein.
>>
>> I'm already able to see all other databases within the IDE (although I
>> deleted them all today except for the one I'm working with).
>>
>> I am up and running on my test machine so I appreciate that. I still say
>> this seems wwwwwwwaaaaaaaaaaaayyyyyyy more complicated than it seems it
>> needs to be. And it scares me knowing I'll have to start from scratch
>> when I want to get it running on my Web site server.
>>
>> I've saved some notes from these conversations. We'll see what happens.
>>
>> Thanks.
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>>
>
>
Author
9 Jan 2007 6:17 AM
Cor Ligthert [MVP]
Jonathan,

As Bill wrote, you cannot run an Micorosft SQL server without the files
(databases) that manage those.

SQL server is a typical product developed by its own department probably not
in Redmond (Bill knows that exact). You see in Microsoft products
departments who often use the same Microsoft touch and feel and those who
seems wanting to show that the can be sold everyday to another company or be
detached from Microsoft.

The SQL server team is in my idea inside the last category, they use
completely there own standards and so their products are not look a like to
other Microsoft programs. It takes a longer learning time and you are the
first days looking strange to that behaviour, when you are used to it, you
accept it.

Just my expirience with that product.

Cor

Show quote
"Jonathan Wood" <jw***@softcircuits.com> schreef in bericht
news:%23b0$UP5MHHA.992@TK2MSFTNGP04.phx.gbl...
> Robin,
>
>> No, I'm just trying to get you connected at all. Once you've connected
>> VS2005 to your SQLServer instance, you should be able to connect to
>> and/or see all of the databases therein.
>
> I'm already able to see all other databases within the IDE (although I
> deleted them all today except for the one I'm working with).
>
> I am up and running on my test machine so I appreciate that. I still say
> this seems wwwwwwwaaaaaaaaaaaayyyyyyy more complicated than it seems it
> needs to be. And it scares me knowing I'll have to start from scratch when
> I want to get it running on my Web site server.
>
> I've saved some notes from these conversations. We'll see what happens.
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
9 Jan 2007 6:35 PM
William (Bill) Vaughn
Huh? SQL Server was written (originally) by Sybase in Berkley California.
Microsoft's version was re-written in Redmond (about 3 miles from this
spot). While "SQL Server" Compact Edition is now being worked on in India,
the rest of the team is here... The SQL Server team is required to work with
the same standards as other Windows teams. While that might not be said for
PowerPoint in the early days, its look and feel has to conform to Microsoft
Windows standards. While the Visual Studio team and the SQL Server team have
a lot of common tasks, I'll agree that their UI elements do not always
commingle very well.

And this is relevant because?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:OAuhWW7MHHA.3268@TK2MSFTNGP04.phx.gbl...
> Jonathan,
>
> As Bill wrote, you cannot run an Micorosft SQL server without the files
> (databases) that manage those.
>
> SQL server is a typical product developed by its own department probably
> not in Redmond (Bill knows that exact). You see in Microsoft products
> departments who often use the same Microsoft touch and feel and those who
> seems wanting to show that the can be sold everyday to another company or
> be detached from Microsoft.
>
> The SQL server team is in my idea inside the last category, they use
> completely there own standards and so their products are not look a like
> to other Microsoft programs. It takes a longer learning time and you are
> the first days looking strange to that behaviour, when you are used to it,
> you accept it.
>
> Just my expirience with that product.
>
> Cor
>
> "Jonathan Wood" <jw***@softcircuits.com> schreef in bericht
> news:%23b0$UP5MHHA.992@TK2MSFTNGP04.phx.gbl...
>> Robin,
>>
>>> No, I'm just trying to get you connected at all. Once you've connected
>>> VS2005 to your SQLServer instance, you should be able to connect to
>>> and/or see all of the databases therein.
>>
>> I'm already able to see all other databases within the IDE (although I
>> deleted them all today except for the one I'm working with).
>>
>> I am up and running on my test machine so I appreciate that. I still say
>> this seems wwwwwwwaaaaaaaaaaaayyyyyyy more complicated than it seems it
>> needs to be. And it scares me knowing I'll have to start from scratch
>> when I want to get it running on my Web site server.
>>
>> I've saved some notes from these conversations. We'll see what happens.
>>
>> Thanks.
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>>
>
>
Author
9 Jan 2007 8:40 PM
Cor Ligthert [MVP]
>
> And this is relevant because?
>
Your discussion with Jonathan, which would if SQL server was more common
behaving as other Microsoft products would not have been in my opinion.

For me it is always strange that I cannot find a copy, cut or paste button
or find that under the right click as it is in any other Microsoft product.

Read well, "My opinion".

Cor
Author
10 Jan 2007 6:19 PM
Cor Ligthert [MVP]
Bill,

If you don't understand this sentence I rephrase him, it is one I can myself
hardly understand.

:-)

Cor

Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht
news:uvuZf4CNHHA.4888@TK2MSFTNGP02.phx.gbl...
> >
>> And this is relevant because?
>>
> Your discussion with Jonathan, which would if SQL server was more common
> behaving as other Microsoft products would not have been in my opinion.
>
> For me it is always strange that I cannot find a copy, cut or paste button
> or find that under the right click as it is in any other Microsoft
> product.
>
> Read well, "My opinion".
>
> Cor
>
Author
8 Jan 2007 6:54 PM
Jonathan Wood
Cor,

> We all try to learn on this board, will you next time the name of books
> you have used as well.

Are you asking for the name of the books?

Well, the two I have in front of my are:

[Microsoft ADO.NET 2.0 Step by Step (Rebecca M. Riordan, MS Press)]
This book provides step by step instructions on creating my database
connection. It starts by telling me to choose the Add New Data Source from
the Data menu. That's very nice. When I read it, I had no Data menu. After
much messing around, I did get into an area where a Data menu appeared.
Unfortunately, it had no Add New Data Source command.

I managed to get the data window on the left side of the screen and there
were other options but none looked like the dialog in the book. But I
eventually worked through them. Several times, I was asked if I wanted
Windows Authentication or SQL Server Authentication. Well, the book wasn't
much help at all there but since this will be a Web application, I thought I
might want to enter a user name and password under SQL Server
Authentication. Well, that's very nice too but it then told me the user name
and password were not valid. (Perhaps I have to drive to Microsoft to
specify what will or will not be valid passwords in my program.)

At one point I did get a dialog box that looks closer to what is in the book
and the book says the following about the Server Name box:

"In the Server Name box, type (local)SQLEXPRESS. The local portion indicates
the local computer, and the SQLEXPRESS is the SQL Server instance name.
IMPORTANT: This book and code samples have been designed for use with a
default installation of Microsoft SQL Server 2005 Express Edition, which has
an instance name of SQLEXPRESS. If you want to use this book with a
different SQL Server instance name or with the full version of SQL Server,
you will have to adjust the exercise steps and connection strings
accordingly."

Well, that's nice too. Apparently, this books recommendation about the
server name field on the regular version of Visual Studio is TO BUY ANOTHER
BOOK!

[Pro ASP.NET 2.0 in C# 2005 (McDonald/Szpuszta)]
In all fairness, this is a large book and I've spent limited time with it.
But I see nothing in the ADO.NET Fundamentals chapter that tells me what I
need to know. It does offer several different types of connection strings,
which I listed in my original post. None of them work for me. That chapter
then jumps right into writing the code without mentioning how to create a
database from the IDE.

> Thank you for informing us that we have to watch this when we buy books
> about AdoNet.

Well, after several replies no one here has provided that specific
information either. Obviously, there's a bit of a hurdle to get from where I
am to where I'm writing code to work with a database I have created. And
it's very frustrating as it seems it could've been made far easier.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
9 Jan 2007 6:24 AM
Cor Ligthert [MVP]
Jonathan,

I am glad that I did not see the books inside your message which are mostly
advised by regulars on this board.

Sceppa, Vaughn and another one but that not advices by me (personal reason
not the book).

For the rest do I see that you have answers enough. I have tried to make a
simple explanation from as how it comes to me in another message in this
thread.

Be happy that you never had to install MSDE (the former SQLExpress). I could
not doing that using the English description how to do it. Lucky enough I
can read Dutch and on that MSDN web was described how to do it.

Cor
Author
8 Jan 2007 8:58 AM
Miha Markic [MVP C#]
Hi Jonatahan,

Well, it depends on some factors.
1. Do you wanna use integrated security (credentials that process is running
under). More secure and recommened as you don't have to store password
anywhere.
2. Do you want to use sql authentication. Less secure as you have to provide
username and password.
3. If 2 then you have to make sure your sql express is configured to allow
sql authentication.
4. If 1 then you have to give sql server privileges to the account under
which your asp.net application is running.

Here is a good article on the topic
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch05.asp

Also be aware that default asp.net processes on 2003 uses different
credentials than the one on xp.

HTH
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/


Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
> Grrr...
>
> I've spent the last several hours trying to learn ADO.NET. Specifically,
> the database connection stuff.
>
> I finally managed to create a database and enter some data within the VS
> IDE. I have several ADO.NET books but not one could tell me how to set up
> my password.
>
> To make a long story short, I ended up setting up a connection using
> (local)\SQLEXPRESS since that's what the only example I could find uses
> and I have no idea what to enter for regular MS SQL.
>
> But I didn't have a change to enter a password or anything like that.
> Based on another book, I tried all of the following:
>
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;Integrated Security=True";
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;Integrated Security=SSPI";
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>
> SqlConnection conn = new SqlConnection(connString);
> conn.Open();
>
> In each case, the code fails on the call to Open(). Here's the message I
> get:
>
> "An error has occurred while establishing a connection to the server.
> When connecting to SQL Server 2005, this failure may be caused by the fact
> that under the default settings SQL Server does not allow remote
> connections. (provider: Named Pipes Provider, error: 40 - Could not open a
> connection to SQL Server)"
>
> Well, that's very helpful. I'm not using a remote connection.
>
> I'm running my Web site in the IDE and will still need to figure out how
> to connect to the database once I copy the site to my Web hosting account
> but I can only deal with so much pain at once.
>
> Is there any help available to figure out how to connect to the database I
> have connected?
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
8 Jan 2007 6:23 PM
Jonathan Wood
I'm a long time programmer who has not done much database programming (I've
worked with Access a bit and did one write a Visual Basic application that
used the Jet database engine many years ago).

I don't know which of the many various technical options I "want". I simply
want to be able to create a database and then access it from my Web
application (written using the full version of Visual Studio 2005) and have
it reasonably secure. If my code needs a user name and password then that's
just fine as long as I have some control over what they are.

At this point, it would be nice just to be able to start writing a little
bit of database code that works even if it requires Integrated Giblet Widget
Security technology.

I'll take a look at the article you referenced. Unfortunately, I'm not
hopeful it will answer my questions at this point.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Show quote
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:O10PSNwMHHA.3312@TK2MSFTNGP03.phx.gbl...
> Hi Jonatahan,
>
> Well, it depends on some factors.
> 1. Do you wanna use integrated security (credentials that process is
> running under). More secure and recommened as you don't have to store
> password anywhere.
> 2. Do you want to use sql authentication. Less secure as you have to
> provide username and password.
> 3. If 2 then you have to make sure your sql express is configured to allow
> sql authentication.
> 4. If 1 then you have to give sql server privileges to the account under
> which your asp.net application is running.
>
> Here is a good article on the topic
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch05.asp
>
> Also be aware that default asp.net processes on 2003 uses different
> credentials than the one on xp.
>
> HTH
> --
> Miha Markic [MVP C#, INETA Country Leader for Slovenia]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
>
> "Jonathan Wood" <jw***@softcircuits.com> wrote in message
> news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
>> Grrr...
>>
>> I've spent the last several hours trying to learn ADO.NET. Specifically,
>> the database connection stuff.
>>
>> I finally managed to create a database and enter some data within the VS
>> IDE. I have several ADO.NET books but not one could tell me how to set up
>> my password.
>>
>> To make a long story short, I ended up setting up a connection using
>> (local)\SQLEXPRESS since that's what the only example I could find uses
>> and I have no idea what to enter for regular MS SQL.
>>
>> But I didn't have a change to enter a password or anything like that.
>> Based on another book, I tried all of the following:
>>
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;Integrated Security=True";
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;Integrated Security=SSPI";
>> string connString = "Data Source=localhost;Initial
>> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>>
>> SqlConnection conn = new SqlConnection(connString);
>> conn.Open();
>>
>> In each case, the code fails on the call to Open(). Here's the message I
>> get:
>>
>> "An error has occurred while establishing a connection to the server.
>> When connecting to SQL Server 2005, this failure may be caused by the
>> fact that under the default settings SQL Server does not allow remote
>> connections. (provider: Named Pipes Provider, error: 40 - Could not open
>> a connection to SQL Server)"
>>
>> Well, that's very helpful. I'm not using a remote connection.
>>
>> I'm running my Web site in the IDE and will still need to figure out how
>> to connect to the database once I copy the site to my Web hosting account
>> but I can only deal with so much pain at once.
>>
>> Is there any help available to figure out how to connect to the database
>> I have connected?
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>>
>
Author
8 Jan 2007 5:30 PM
William (Bill) Vaughn
I hope it was not my book that lead you astray. Getting connected to SQL
Express can be a bit tricky... it's born deaf and blind. See my blog for a
whitepaper on connecting issues and perhaps my book (which has a long
chapter on connecting) will help...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:OtPeTqtMHHA.1252@TK2MSFTNGP02.phx.gbl...
> Grrr...
>
> I've spent the last several hours trying to learn ADO.NET. Specifically,
> the database connection stuff.
>
> I finally managed to create a database and enter some data within the VS
> IDE. I have several ADO.NET books but not one could tell me how to set up
> my password.
>
> To make a long story short, I ended up setting up a connection using
> (local)\SQLEXPRESS since that's what the only example I could find uses
> and I have no idea what to enter for regular MS SQL.
>
> But I didn't have a change to enter a password or anything like that.
> Based on another book, I tried all of the following:
>
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;Integrated Security=True";
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;Integrated Security=SSPI";
> string connString = "Data Source=localhost;Initial
> Catalog=BlackBeltCoder;user id=sa;password=opensesame";
>
> SqlConnection conn = new SqlConnection(connString);
> conn.Open();
>
> In each case, the code fails on the call to Open(). Here's the message I
> get:
>
> "An error has occurred while establishing a connection to the server.
> When connecting to SQL Server 2005, this failure may be caused by the fact
> that under the default settings SQL Server does not allow remote
> connections. (provider: Named Pipes Provider, error: 40 - Could not open a
> connection to SQL Server)"
>
> Well, that's very helpful. I'm not using a remote connection.
>
> I'm running my Web site in the IDE and will still need to figure out how
> to connect to the database once I copy the site to my Web hosting account
> but I can only deal with so much pain at once.
>
> Is there any help available to figure out how to connect to the database I
> have connected?
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
8 Jan 2007 6:55 PM
Jonathan Wood
William,

>I hope it was not my book that lead you astray. Getting connected to SQL
>Express can be a bit tricky...

Yeah, particularly when you're not using SQL Expres (I think).

> it's born deaf and blind. See my blog for a whitepaper on connecting
> issues and perhaps my book (which has a long chapter on connecting) will
> help...

I must admit, I'm getting a bit pessimistic about that. Especially, when I
have several books and I'm not any closer to connecting to my database even
after getting several replies from this group.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
8 Jan 2007 7:09 PM
RobinS
What do you mean, "I think"? Do you not know if you're using
SQLServer of SQLExpress? Is it on your machine? Did you
install it?

Robin S.
-----------------
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:e9GFAb1MHHA.3424@TK2MSFTNGP02.phx.gbl...
> William,
>
>>I hope it was not my book that lead you astray. Getting connected to
>>SQL Express can be a bit tricky...
>
> Yeah, particularly when you're not using SQL Expres (I think).
>
>> it's born deaf and blind. See my blog for a whitepaper on connecting
>> issues and perhaps my book (which has a long chapter on connecting)
>> will help...
>
> I must admit, I'm getting a bit pessimistic about that. Especially,
> when I have several books and I'm not any closer to connecting to my
> database even after getting several replies from this group.
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
8 Jan 2007 7:12 PM
Jonathan Wood
Installing VS 2005 seemed to have taken around 45 minutes. Are you asking me
to remember each and every component that was installed during that process?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

Show quote
"RobinS" <RobinS@NoSpam.yah.none> wrote in message
news:voOdnQNE1-xGCz_YnZ2dnUVZ_uKknZ2d@comcast.com...
> What do you mean, "I think"? Do you not know if you're using
> SQLServer of SQLExpress? Is it on your machine? Did you
> install it?
>
> Robin S.
> -----------------
> "Jonathan Wood" <jw***@softcircuits.com> wrote in message
> news:e9GFAb1MHHA.3424@TK2MSFTNGP02.phx.gbl...
>> William,
>>
>>>I hope it was not my book that lead you astray. Getting connected to SQL
>>>Express can be a bit tricky...
>>
>> Yeah, particularly when you're not using SQL Expres (I think).
>>
>>> it's born deaf and blind. See my blog for a whitepaper on connecting
>>> issues and perhaps my book (which has a long chapter on connecting) will
>>> help...
>>
>> I must admit, I'm getting a bit pessimistic about that. Especially, when
>> I have several books and I'm not any closer to connecting to my database
>> even after getting several replies from this group.
>>
>> Thanks.
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>>
>
>
Author
8 Jan 2007 8:32 PM
RobinS
If it was installed with Visual Studio, then you have SQLServer Express.
Merry Christmas (late), one question resolved.

Robin S.
--------------------------
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:uqPeUk1MHHA.4000@TK2MSFTNGP06.phx.gbl...
> Installing VS 2005 seemed to have taken around 45 minutes. Are you
> asking me to remember each and every component that was installed
> during that process?
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
> "RobinS" <RobinS@NoSpam.yah.none> wrote in message
> news:voOdnQNE1-xGCz_YnZ2dnUVZ_uKknZ2d@comcast.com...
>> What do you mean, "I think"? Do you not know if you're using
>> SQLServer of SQLExpress? Is it on your machine? Did you
>> install it?
>>
>> Robin S.
>> -----------------
>> "Jonathan Wood" <jw***@softcircuits.com> wrote in message
>> news:e9GFAb1MHHA.3424@TK2MSFTNGP02.phx.gbl...
>>> William,
>>>
>>>>I hope it was not my book that lead you astray. Getting connected to
>>>>SQL Express can be a bit tricky...
>>>
>>> Yeah, particularly when you're not using SQL Expres (I think).
>>>
>>>> it's born deaf and blind. See my blog for a whitepaper on
>>>> connecting issues and perhaps my book (which has a long chapter on
>>>> connecting) will help...
>>>
>>> I must admit, I'm getting a bit pessimistic about that. Especially,
>>> when I have several books and I'm not any closer to connecting to my
>>> database even after getting several replies from this group.
>>>
>>> Thanks.
>>>
>>> --
>>> Jonathan Wood
>>> SoftCircuits Programming
>>> http://www.softcircuits.com
>>>
>>>
>>
>>
>
>
Author
8 Jan 2007 7:59 PM
William (Bill) Vaughn
Ok, I understand.
When you install any version of Visual Studio (even the Express SKU), it
installs SQL Server Express Edition (quietly). There's no reason you should
have known that. To determine if you have SQL Server Express installed, use
the Server Explorer in Visual Studio and click on Servers | YourSystem |
Services and scroll down to see if "SQL Server (SQLEXPRESS)" is listed. If
it's there, you have an instance of SQL Server (named "SQLEXPRESS")
installed and (possibly) running on your system. This assumes you aren't
running the Express SKU of Visual Studio as this exposes a "database"
explorer instead with far more limited functionality.

When connecting to any instance of SQL Server, you have to establish who you
are and which database on the server (it can support virtually any number of
databases) you want to use. You identify yourself with username and password
credentials. These can either be supplied by Windows authentication (as when
you logged on to your system or on to a domain) or by SQL Server
authentication. By default, only Windows authentication is enabled (on all
SKUs of SQL Server). This means that SQL Server must have a Login account
setup to permit access to the server. By default, SQL Server permits members
of the Administrators group to be granted access to the server. If you don't
have a Username and Password in your ConnectionString, you must have
"Trusted Connection=Yes" or "Integrated Security=SSPI" to indicate that SQL
Server is to use the current user's Windows authentication credentials.
However, when creating an application, you can't assume that the end-user
will have those rights.

I discuss how to configure the server and all of this in far more detail in
my latest book--See Chapter 9.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:e9GFAb1MHHA.3424@TK2MSFTNGP02.phx.gbl...
> William,
>
>>I hope it was not my book that lead you astray. Getting connected to SQL
>>Express can be a bit tricky...
>
> Yeah, particularly when you're not using SQL Expres (I think).
>
>> it's born deaf and blind. See my blog for a whitepaper on connecting
>> issues and perhaps my book (which has a long chapter on connecting) will
>> help...
>
> I must admit, I'm getting a bit pessimistic about that. Especially, when I
> have several books and I'm not any closer to connecting to my database
> even after getting several replies from this group.
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
8 Jan 2007 8:26 PM
Jonathan Wood
William,

> When you install any version of Visual Studio (even the Express SKU), it
> installs SQL Server Express Edition (quietly). There's no reason you
> should have known that.

Yes, thank you!

> To determine if you have SQL Server Express installed, use the Server
> Explorer in Visual Studio and click on Servers | YourSystem | Services and
> scroll down to see if "SQL Server (SQLEXPRESS)" is listed. If it's there,
> you have an instance of SQL Server (named "SQLEXPRESS") installed and
> (possibly) running on your system. This assumes you aren't running the
> Express SKU of Visual Studio as this exposes a "database" explorer instead
> with far more limited functionality.

Yes, there is an entry named "SQL Server (SQLEXPRESS)".

Suddenly, I feel I'm actually moving forward. However, there are two issues
in my mind. 1) It appears I have SQL Server Express, but I'm not as sure
that's the version I want to use. And 2) I will eventually move this to my
Web server (currently hosted by GoDaddy.com) and assume I will need to use
whatever they have.

Show quote
> When connecting to any instance of SQL Server, you have to establish who
> you are and which database on the server (it can support virtually any
> number of databases) you want to use. You identify yourself with username
> and password credentials. These can either be supplied by Windows
> authentication (as when you logged on to your system or on to a domain) or
> by SQL Server authentication. By default, only Windows authentication is
> enabled (on all SKUs of SQL Server). This means that SQL Server must have
> a Login account setup to permit access to the server. By default, SQL
> Server permits members of the Administrators group to be granted access to
> the server. If you don't have a Username and Password in your
> ConnectionString, you must have "Trusted Connection=Yes" or "Integrated
> Security=SSPI" to indicate that SQL Server is to use the current user's
> Windows authentication credentials. However, when creating an application,
> you can't assume that the end-user will have those rights.

To reiterate, this is a Web site I'm developing (although I do plan to
develop some desktop applications in the future that will use a database).
Here are the connection strings I've tried to far:

1. "Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
Security=True"
2. "Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
Security=SSPI"
3. "Data Source=localhost;Initial Catalog=BlackBeltCoder;user
id=sa;password=opensesame"

In all cases, the following code fails:

SqlConnection conn = new SqlConnection(connString);
conn.Open();

I just get a message about not being configured for remote connections,
which I don't understand since (at least, so far) it would seem to be a
local connection.

> I discuss how to configure the server and all of this in far more detail
> in my latest book--See Chapter 9.

Well, perhaps I should look out for that then.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
8 Jan 2007 9:40 PM
William (Bill) Vaughn
Ok, then you have other issues to consider.
1) When using any instance of SQL Server you can access it via the network
(via netlibs like TCP/IP or named pipes) and a NIC or you can access it via
the (default) Shared Memory provider. This second option does not require
going through the NIC. This is the default for SQL Express as it's initially
intended to be accessed from the client system.
2) Yes, you can access a SQL Express instance from a hosted ISP, but this
assumes the ISP will let you install it. Some won't--thus the need for
alternative DBMS engines that they don't have to manage. Yes, management is
a serious issue. It includes backups, log truncation, security and more.
3) The MacDonald book is a good one. My daughter Fred edited it (or an
earlier version) and I use it as my ASP.NET reference. It is a must-read for
ASP developers. My book is predominantly for Visual Studio/SQL Server
developers as it discusses issues that all architectures are likely to see
but it only uses Windows Forms examples. That's because too many developers
think they need ASP when they don't--not really and the concepts apply
across the board.
4) When you build a ConnectionString, it's not enough to simply reference
the local system, you have to reference the specific named instance of SQL
Server. That's because there could be a dozen instances hosted on the
system. A correct connection string (in your case) could look like this:

    "Server=local\SQLEXPRESS;integrated security=SSPI;initial
Catalog=BlackBeltCoder"

Note that I used "local", not "localhost" which is used in a URL. You can
also use "." as in ".\SQLEXPRESS" as well to refer to the local system
(whatever its name is). Don't be confused by the (unfortunate) exception
message you get back from ADO.NET. It has lead many developers astray.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:OOkeiN2MHHA.4992@TK2MSFTNGP04.phx.gbl...
> William,
>
>> When you install any version of Visual Studio (even the Express SKU), it
>> installs SQL Server Express Edition (quietly). There's no reason you
>> should have known that.
>
> Yes, thank you!
>
>> To determine if you have SQL Server Express installed, use the Server
>> Explorer in Visual Studio and click on Servers | YourSystem | Services
>> and scroll down to see if "SQL Server (SQLEXPRESS)" is listed. If it's
>> there, you have an instance of SQL Server (named "SQLEXPRESS") installed
>> and (possibly) running on your system. This assumes you aren't running
>> the Express SKU of Visual Studio as this exposes a "database" explorer
>> instead with far more limited functionality.
>
> Yes, there is an entry named "SQL Server (SQLEXPRESS)".
>
> Suddenly, I feel I'm actually moving forward. However, there are two
> issues in my mind. 1) It appears I have SQL Server Express, but I'm not as
> sure that's the version I want to use. And 2) I will eventually move this
> to my Web server (currently hosted by GoDaddy.com) and assume I will need
> to use whatever they have.
>
>> When connecting to any instance of SQL Server, you have to establish who
>> you are and which database on the server (it can support virtually any
>> number of databases) you want to use. You identify yourself with username
>> and password credentials. These can either be supplied by Windows
>> authentication (as when you logged on to your system or on to a domain)
>> or by SQL Server authentication. By default, only Windows authentication
>> is enabled (on all SKUs of SQL Server). This means that SQL Server must
>> have a Login account setup to permit access to the server. By default,
>> SQL Server permits members of the Administrators group to be granted
>> access to the server. If you don't have a Username and Password in your
>> ConnectionString, you must have "Trusted Connection=Yes" or "Integrated
>> Security=SSPI" to indicate that SQL Server is to use the current user's
>> Windows authentication credentials. However, when creating an
>> application, you can't assume that the end-user will have those rights.
>
> To reiterate, this is a Web site I'm developing (although I do plan to
> develop some desktop applications in the future that will use a database).
> Here are the connection strings I've tried to far:
>
> 1. "Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
> Security=True"
> 2. "Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
> Security=SSPI"
> 3. "Data Source=localhost;Initial Catalog=BlackBeltCoder;user
> id=sa;password=opensesame"
>
> In all cases, the following code fails:
>
> SqlConnection conn = new SqlConnection(connString);
> conn.Open();
>
> I just get a message about not being configured for remote connections,
> which I don't understand since (at least, so far) it would seem to be a
> local connection.
>
>> I discuss how to configure the server and all of this in far more detail
>> in my latest book--See Chapter 9.
>
> Well, perhaps I should look out for that then.
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Author
8 Jan 2007 11:23 PM
Jonathan Wood
William,

> Ok, then you have other issues to consider.
> 1) When using any instance of SQL Server you can access it via the network
> (via netlibs like TCP/IP or named pipes) and a NIC or you can access it
> via the (default) Shared Memory provider. This second option does not
> require going through the NIC. This is the default for SQL Express as it's
> initially intended to be accessed from the client system.

I just don't really know what that means. For testing, I will want to use
the database on my computer. After deployment, I'll want to copy the
database to the computer that hosts my Web site, and my Web site will use
the database on that same computer.

> 2) Yes, you can access a SQL Express instance from a hosted ISP, but this
> assumes the ISP will let you install it. Some won't--thus the need for
> alternative DBMS engines that they don't have to manage. Yes, management
> is a serious issue. It includes backups, log truncation, security and
> more.

The company that hosts my Web sites has the ASP.NET 2.0 frameworks
installed. My understanding is that includes a database engine. Why would I
want to install a different one?

> 3) The MacDonald book is a good one. My daughter Fred edited it (or an
> earlier version) and I use it as my ASP.NET reference. It is a must-read
> for ASP developers. My book is predominantly for Visual Studio/SQL Server
> developers as it discusses issues that all architectures are likely to see
> but it only uses Windows Forms examples. That's because too many
> developers think they need ASP when they don't--not really and the
> concepts apply across the board.

Yeah, I actually have two of his books (Pro and Beginning). They are big
books and I really have spent very limited time with them.

I'm extremely busy with other projects and I absolutely must get up and
running with .NET and databases before I will be in a position to read all
the stuff I have. It's a very difficult position. I guess I was optimistic
that I'd be able to get to the point where I could open my database from
code without reading all these books. Perhaps I was wrong.

> 4) When you build a ConnectionString, it's not enough to simply reference
> the local system, you have to reference the specific named instance of SQL
> Server. That's because there could be a dozen instances hosted on the
> system. A correct connection string (in your case) could look like this:
>
>    "Server=local\SQLEXPRESS;integrated security=SSPI;initial
> Catalog=BlackBeltCoder"
>
> Note that I used "local", not "localhost" which is used in a URL. You can
> also use "." as in ".\SQLEXPRESS" as well to refer to the local system
> (whatever its name is). Don't be confused by the (unfortunate) exception
> message you get back from ADO.NET. It has lead many developers astray.

I was just copying some of the many examples in MacDonald's Pro book.

Okay, here's what I got:

string connString = "Server=local\\SQLEXPRESS;integrated
security=SSPI;initial Catalog=BlackBeltCoder";

That gives me an error. However:

string connString = "Server=localhost\\SQLEXPRESS;integrated
security=SSPI;initial Catalog=BlackBeltCoder";

This actually works! With some additional messing around, I also found the
following works!

string connString = "Data Source=<sysname>\\SQLExpress;Initial
Catalog=BlackBeltCoder;Integrated Security=True";

Where <sysname> is the name for my system.

So I'm not sure I followed your comment about local vs. localhost, but only
localhost works for me.

At any rate, if I can find your book, I'll take a look. If you can explain
the above, I'm all ears.

I'm now able to continue development on this project because I can actually
connect to a database. However, I still don't understand why, the best way
to create the database, or what I'll need to change when I move it to my Web
site. But one thing at a time.

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Author
8 Jan 2007 11:47 PM
William (Bill) Vaughn
See -->

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message
news:%23XRJlw3MHHA.448@TK2MSFTNGP04.phx.gbl...
> William,
>
>> Ok, then you have other issues to consider.
>> 1) When using any instance of SQL Server you can access it via the
>> network (via netlibs like TCP/IP or named pipes) and a NIC or you can
>> access it via the (default) Shared Memory provider. This second option
>> does not require going through the NIC. This is the default for SQL
>> Express as it's initially intended to be accessed from the client system.
>
> I just don't really know what that means. For testing, I will want to use
> the database on my computer. After deployment, I'll want to copy the
> database to the computer that hosts my Web site, and my Web site will use
> the database on that same computer.

--> There are two parts to the problem. First, the DBMS engine as configured
on your system must be reproduced (reconfigured in the same way) on the
target server. Next, the database managed by SQL Server must be transported
and attached to the target DBMS engine when you're ready to deploy. That's
the nature of SQL Server and most DBMS platforms like it.

>
>> 2) Yes, you can access a SQL Express instance from a hosted ISP, but this
>> assumes the ISP will let you install it. Some won't--thus the need for
>> alternative DBMS engines that they don't have to manage. Yes, management
>> is a serious issue. It includes backups, log truncation, security and
>> more.
>
> The company that hosts my Web sites has the ASP.NET 2.0 frameworks
> installed. My understanding is that includes a database engine. Why would
> I want to install a different one?

---> No, not really. The 2.0 Framework does not include a DBMS engine of any
kind. It does include ADO.NET which is simply a set of classes used to
access any selected DBMS engine that has a .NET Provider of some kind.
You're going to have the ISP install SQL Server (of some kind) on the target
IIS server or on a server local (or at least visible) to that site. This is
not always that easy.


Show quote
>
>> 3) The MacDonald book is a good one. My daughter Fred edited it (or an
>> earlier version) and I use it as my ASP.NET reference. It is a must-read
>> for ASP developers. My book is predominantly for Visual Studio/SQL Server
>> developers as it discusses issues that all architectures are likely to
>> see but it only uses Windows Forms examples. That's because too many
>> developers think they need ASP when they don't--not really and the
>> concepts apply across the board.
>
> Yeah, I actually have two of his books (Pro and Beginning). They are big
> books and I really have spent very limited time with them.
>
> I'm extremely busy with other projects and I absolutely must get up and
> running with .NET and databases before I will be in a position to read all
> the stuff I have. It's a very difficult position. I guess I was optimistic
> that I'd be able to get to the point where I could open my database from
> code without reading all these books. Perhaps I was wrong.
>
>> 4) When you build a ConnectionString, it's not enough to simply reference
>> the local system, you have to reference the specific named instance of
>> SQL Server. That's because there could be a dozen instances hosted on the
>> system. A correct connection string (in your case) could look like this:
>>
>>    "Server=local\SQLEXPRESS;integrated security=SSPI;initial
>> Catalog=BlackBeltCoder"
>>
>> Note that I used "local", not "localhost" which is used in a URL. You can
>> also use "." as in ".\SQLEXPRESS" as well to refer to the local system
>> (whatever its name is). Don't be confused by the (unfortunate) exception
>> message you get back from ADO.NET. It has lead many developers astray.
>
> I was just copying some of the many examples in MacDonald's Pro book.
>
> Okay, here's what I got:
>
> string connString = "Server=local\\SQLEXPRESS;integrated
> security=SSPI;initial Catalog=BlackBeltCoder";
>
> That gives me an error. However:
>
> string connString = "Server=localhost\\SQLEXPRESS;integrated
> security=SSPI;initial Catalog=BlackBeltCoder";
>
> This actually works! With some additional messing around, I also found the
> following works!

---> "localhost" resolves to the machinename in most cases, but I've not had
a lot of success with it in ConnectionStrings. The "\\" might be part of the
issue. Remember that when you run an ASP application, it's IIS that opens
the connection for you--not the local browser user. It uses a special
account that Rob discusses in his book. So do I, but not to as great an
extent.
Show quote
>
> string connString = "Data Source=<sysname>\\SQLExpress;Initial
> Catalog=BlackBeltCoder;Integrated Security=True";
>
> Where <sysname> is the name for my system.
>
> So I'm not sure I followed your comment about local vs. localhost, but
> only localhost works for me.
>
> At any rate, if I can find your book, I'll take a look. If you can explain
> the above, I'm all ears.
>
> I'm now able to continue development on this project because I can
> actually connect to a database. However, I still don't understand why, the
> best way to create the database, or what I'll need to change when I move
> it to my Web site. But one thing at a time.
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
>