|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What's My Password?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? 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 > > Good question.
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 >> >> > > 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 >>> >>> >> >> > > Robin,
> I'm not sure what that means. Does that mean you don't know? Yes, it means that I do not know. And, yes, I'm trying to figure out which > You said in another post you were trying to figure out > which technical option you wanted. technical options I "want". > The reason I asked is because I had this problem with SQLServer I doubt it. My issue is more of a (which should be) basic issues I'm trying > 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. 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 First off, I have a hunch I'm not using SQL Server Express (based on the > 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. 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? 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 > > Robin,
> If you installed it, and didn't pay big money for it, it's I simply cannot believe there is no way to tell the difference without > 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? 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/ I do have a Microsoft SQL Server 2005 options in my All Programs menu.> MicrosoftSQLServer2005/... and you'll have a bunch of options. > As for the remote connection thing, I don't understand it Sounds right. Now all I need to do is figure out what to do about 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. 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 > > 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 >> >> > > "RobinS" <RobinS@NoSpam.yah.none> wrote in message So is that what it's asking me? The user name and password to my computer? 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. 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 >>> >>> >> >> > > 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 >>>> >>>> >>> >>> >> >> > > Robin,
> Where is it asking you for the username and password? Because It isn't. However, the connection string can include a user name and > if I use integrated security, it doesn't ask me, it collects > that information from Windows. password, and it appears the connection string is where I'm currently hung up. > Here's an example of connection string I'm using: And, here again, are the ones I tried:> > Data Source=xMyMachineName\xMySQLServerName;Initial > Catalog=myFavoriteDB;Integrated Security=True "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 Where is this? Is this the Data Source value in the connection string or > 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". something else? Show quote > To create a SQLServer database using Server Explorer in VS2005: I'm happy to try this (I haven't yet). In fact, I'm printing this out.> > 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>. 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. Look for *** below.
Robin S. ---------------------------------- Show quote "Jonathan Wood" <jw***@softcircuits.com> wrote in message *** I would use this one, but you need \sqlservername afternews: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" localhost. Show quote > "Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated You can put your computer name in, instead of using "localhost".> 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 > No, I'm just trying to get you connected at all. Once you've connected>> 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? VS2005 to your SQLServer instance, you should be able to connect to and/or see all of the databases therein. > Good luck.> Thanks. > Jonathan Wood Robin S. Robin,
> No, I'm just trying to get you connected at all. Once you've connected I'm already able to see all other databases within the IDE (although I > VS2005 to your SQLServer instance, you should be able to connect to > and/or see all of the databases therein. 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.
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message I was going to say, "It's always easier the second time",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 > 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. Robin,
> I was going to say, "It's always easier the second time", Everything is easier when you've figured it out. It's the figuring out that > 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. can be hard. <g> > I think he's referring to the MacDonald book you already have. That was Mathew MacDonald I was talking about. Not sure about the Rob.> I was thinking about buying the VB version, and now that I know > Bill thinks it's a good book, I probably will. 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. -- Show quote____________________________________ 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 > > 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. 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 >> >> > > 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 > > 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? -- Show quote____________________________________ 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) ----------------------------------------------------------------------------------------------------------------------- "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 >> >> > > > Your discussion with Jonathan, which would if SQL server was more common > And this is relevant because? > 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 Bill,
If you don't understand this sentence I rephrase him, it is one I can myself hardly understand. :-) CorShow 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 > Cor,
> We all try to learn on this board, will you next time the name of books Are you asking for the name of the books?> you have used as well. 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 Well, after several replies no one here has provided that specific > about AdoNet. 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,
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 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 -- Show quoteMiha 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 > > 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. 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 >> >> > 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... -- Show quote____________________________________ 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: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 > > William,
>I hope it was not my book that lead you astray. Getting connected to SQL Yeah, particularly when you're not using SQL Expres (I think).>Express can be a bit tricky... > it's born deaf and blind. See my blog for a whitepaper on connecting I must admit, I'm getting a bit pessimistic about that. Especially, when I > issues and perhaps my book (which has a long chapter on connecting) will > help... have several books and I'm not any closer to connecting to my database even after getting several replies from this group. Thanks. 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 > > 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? 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 >> >> > > 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 >>> >>> >> >> > > 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. -- Show quote____________________________________ 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: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 > > William,
> When you install any version of Visual Studio (even the Express SKU), it Yes, thank you!> 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 Yes, there is an entry named "SQL Server (SQLEXPRESS)".> 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. 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 To reiterate, this is a Web site I'm developing (although I do plan to > 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. 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 Well, perhaps I should look out for that then.> in my latest book--See Chapter 9. Thanks. 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 -- Show quote____________________________________ 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: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 > > William,
> Ok, then you have other issues to consider. I just don't really know what that means. For testing, I will want to use > 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. 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 The company that hosts my Web sites has the ASP.NET 2.0 frameworks > 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. 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 Yeah, I actually have two of his books (Pro and Beginning). They are big > 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. 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 I was just copying some of the many examples in MacDonald's Pro book.> 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. 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. See -->
-- Show quote____________________________________ 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 --> There are two parts to the problem. First, the DBMS engine as configured 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. 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. > ---> No, not really. The 2.0 Framework does not include a DBMS engine of any >> 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? 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 > ---> "localhost" resolves to the machinename in most cases, but I've not had >> 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! 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 > > | |||||||||||||||||||||||