DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   VB.Net and sql server connection (http://www.daniweb.com/forums/thread76948.html)

pvi Apr 30th, 2007 11:44 am
VB.Net and sql server connection
 
I'm tyring to connect to the sql server on my lcoal machine and have this error.
"An error has occured establishing connection to the server. Failure may be caused by the fact that under the default settings SQL server does nto allow remote connections.(provider:Named Pipes Provider,error 40 - could not open a connection to sql server)"

Can someone help me fix this?

Thanks

Sawe Apr 30th, 2007 12:14 pm
Re: VB.Net and sql server connection
 
can you post your code

jbennet Apr 30th, 2007 2:47 pm
Re: VB.Net and sql server connection
 
Is it SQL express or the full version?
If so what version is it?

pvi Apr 30th, 2007 3:51 pm
Re: VB.Net and sql server connection
 
Quote:

Originally Posted by Sawe (Post 355831)
can you post your code

The code is as follows:

Dim strConn As String = "Integrated Security=True;" & _
"Initial Catalog=Cargo;" & _
"Data Source=localhost"

pvi Apr 30th, 2007 4:00 pm
Re: VB.Net and sql server connection
 
Quote:

Originally Posted by jbennet (Post 355904)
Is it SQL express or the full version?
If so what version is it?

It's the SqlServer express edition downlaoded from the net. Do I need to make changes to the settings in the configuration Manager?

Thanks.

Proteus Apr 30th, 2007 4:34 pm
Re: VB.Net and sql server connection
 
Try instead of localhost --> localhost\SQLEXPRESS

jbennet Apr 30th, 2007 5:39 pm
Re: VB.Net and sql server connection
 
yes, try that

If that doesnt work you may need to mess about with the config (sql express is set up to be secure by default, so only the local machine can connetc to it. some code doesnt like this)

janet_ss Jan 14th, 2009 1:31 am
Re: VB.Net and sql server connection
 
do like this.

connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password"
connection = New SqlConnection(connetionString)

jannet.

Comatose Jan 14th, 2009 9:40 am
Re: VB.Net and sql server connection
 
Erm, you know this thread is like 2 years old?


All times are GMT -4. The time now is 3:16 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC