Sunday, February 26, 2012

Error:40

I'm using VS2005 Standard Edition with SQL 2000 and get the following error message:

Whenconnecting to SQL Server 2005, this failure may be caused by the factthat under the default settings SQL Server does not allow remoteconnections. (provider: Named Pipes Provider, error: 40 - Could notopen a connection to SQL Server)

I've seen lots of people talking about SQL2005 Express but I'm not even using that version?? I know it gets installed by default when you install VS2005 but I've never used it. I've checked the connection properties to make sure that "using local and remote connections" is checked etc, but still I get the error can any one please help?

Hey,

You can configure that through the SQL Server Surface Area Configuration tool for SQL 2005; I'm assuming that you may be doing something that created the ASPNETDB.mdf file that contains membership/role/profile/other information in it by default... You can tell if you refresh the App_Data folder...

|||Hi,

It did create the ASPNETDB.mdf file and asked me if I wanted to put it somewhere....
I'd been through the surface area tool and made sure that everything is 'enabled' i.e. IP/TCP

I've used sql express before with VWD Express and I never had any problems, but now using a full version of VS2005 it all falls apart! Should I delete the ASPNETDB.mdf file as I'm not using sql express?

This whole problem is driving me up the wall!!|||

Hey,

You don't have to use the ASPNETDB.mdf file, but if you don't use a custom provider, and you access a feature that uses membership/personalization, or if you use the ASP.NET configuration tool, then it will create it for you. Be aware of that...

So you setup under View by Instance > Database Engine> Remote Connections, and made it local and remote connections?

|||Sorry, what program should I be using to do: So you setup under View by Instance > Database Engine> Remote Connections, and made it local and remote connections ?

Many thanks,
James|||Sorry, what program should I be using to do: So you setup under View byInstance > Database Engine> Remote Connections, and made it localand remote connections ?

Many thanks,
James|||Oh, sorry, the SQL Server Surface Area Configuration tool. Then click the first option link (view by ... forget the exact text)|||I have configured as you advised, Remote Connections > Local And Remote Connections
but the sub option I chose was "Using TCP/IP Only", is this correct or should I have chosen the
"Using both TCP/IP and named pipes" option?

Many thanks|||

Hey,

Try TCP/IP only; if that still gives you an error, try named pipes as well. If both don't correct the problem, we know it isn't related to that...

|||I've tried both and it's still the same error.
All I'm trying to do is click on a hyperlink within a gridviewand it passes to another page with a querystring object. The gridview itself populates fine from a remote database which makes me think maybe its something else too!

I'm in the process of migrating an application I created from asp 1.1 (vs2003) to 2.0 (vs2005)
Ihave a datagrid with a hyperlink with a querystring column that whenclicked takes you to another page with parameter "id={0}". However, thedatagrid property builder in vs2003 makes me use three items:
textfield (column name from sql database)
URLField (StudentId - the primary key from sql table)
URLFormatString (updateStudent.aspx?id={0} - this is the page i'm navigating to along with my param)

but in vs2005 the gridview has different options (DataNavigateURL .....etc)
Are you please able to tell me what data needs to go in what property box on the GridView ?

Many thanks
James|||

Hey,

Yeah, DataNavigateUrl is the name of the field that is the ID value in the querystring. DataNavigateUrlFormatString is where you put the page name and the querystring text, such as "otherpage.aspx?id={0}" when the code runs, {0} gets replaced with the value in the field specified by DataNavigateUrl. You can also specify DataTextField to dynamically get the text value and the DataTextFieldFormatString to format that text as well, or just use Text to render static text for the link.

|||

jimmy_fingers:

I'm using VS2005 Standard Edition with SQL 2000 and get the following error message:

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)

I've seen lots of people talking about SQL2005 Express but I'm not even using that version?? I know it gets installed by default when you install VS2005 but I've never used it. I've checked the connection properties to make sure that "using local and remote connections" is checked etc, but still I get the error can any one please help?

In Enterprise Manager at the top right click and go to server properties then Network Configurations make sure both TCP/IP and Named Pipes is enabled. Then go to VS2005 at the top click on the Data Link Property to connect. Hope this helps.

|||I appear to have all three properties set up correctly:
DataNavigateUrlField - studentId (primary key for the table in question)
DataNavigateUrlFormatString - updateStudents.aspx?id={0}
DataTextField - StudentName (table column being displayed)

but I'm still getting the same error??|||I'm so very sorry I feel such an idiot!!! I'd made a mistake with my connection string in web.config file.
Although I had done the auto connection I had also hard coded a connection string myself and made a spelling mistake - ROOKIE ERROR! lol

Many thanks though for your help,
James|||

Hey,

No problem. I do it all the time. Smile

No comments:

Post a Comment