Showing posts with label express. Show all posts
Showing posts with label express. Show all posts

Wednesday, March 28, 2012

Invalid value for key attachdbfilename.

HI,

We upgraded to SQL Server 2005 Standard Edition for our ASP.NET 2.0 website. We were using SQL Server Express 2005. That worked fine. Now we are unable to connect to the database. I have googled, but I just cann't figure out what is going on. Any help is appreciated. Here is the error.

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

In our firewall sqlbrowser.exe and sqlservr.exe are allowed.

Thanks Matt

Matt,

I have seen this error everytime I install MS SQL 2005, you need to enable TCP/IP as by default is not

Open the program -> SQL Server Surface Configuration

Go To -> Surface Area Configuration and Connections

Go To -> Remote Connections

and change Local Connections only to

Local and Remote connections

|||

AL,

Thank you for the quick reply. I did what you said and it was configured to,

Local and Remote Connections

Using both TCP/IP and named pipes,

already.

My databases reside inside my App_Data folder in my ASP.NET 2.0 application.

Do you have any other ideas?

Could it be my connection string?

Thank you again.

Matt

|||

Matt,

My biggest apologies, I jump to the answer as I have seen this message more than once. Again sorry.

If you already configured that, and you open all the ports on the firewall, I do not remember the port number but you can test from one computer to the other by opening a dos box and doing

telnet servername portnumber

If connects, you are good!! If does not ... open the port in the firewall

|||

Al,

Thank you again for helping me. I think that it is my fault. I don't think I have given you enough information about my situation.

I am trying to move my asp.net 2.0 website from sql server express to sql server 2005 standard edition.

So far all I have done is uninstall sql express and then installed sql server 2005.

I configured sql server 2005 with, what I assume to be the standard setup. I just used the wizard and did not change anything else. Those settings from the previous post were what was already checked when you told me to look at them. I did not set them.

I think from the little bit of research I have done, that I cann't use the AttachDbFile feature that sql express uses for sql server 2005?

At this point I am completely lost and frustrated. I am fairly new to this and trying hard to figure it out.

I do appreciate the help.

Any suggestion or ideas?

Thank You Again

Matt

|||

Actually attaching the database is the best solution. Also check on the logins after attaching that the username and password are correct. You can use VS2005 to connect to a database to see if that test works, there is a great wizard with great errors that might tell you what the problem is.

Besides that I am pretty lost, should work :-(

|||

Al,

Thank you for the help. I got it to work with one database. I used the wizrd and it worked great.

I also created a user in sql server 2005. I gave it a bunch of permissions just to get it to work. I think I should narrow thoses down to only the ones it needs.

My only other question is, I ran the aspnet_regsql.exe and it created a database in sql server 2005. But I was unable to use the ASP.NET Configuration tool to create roles and users. I made the same type of connection as with my other database. Error below.

The following message may help in diagnosing the problem:A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)

Any ideas?

Thank You Again

Matt

|||When you use ASP.NET Configuration, make sure you give it a connection string that will work on the NEW DATABASE for users and roles. If you connect to the new database, you'll see the providers tab|||

Al,

Thanks again. I got it all working now. It was the connection string.

Thanks

Matt

|||

Did you figure it by going to ASP.NET Configuration?

Glad you fix it! Stick around!

|||

No, I worked through it on a post by scottgu. I had .mdf in my connectionstring. When I removed .mdf, it made the connection.

Thanks Matt

|||Ah! Mr Guthrie's blog is like a gold mine!

Monday, March 26, 2012

Invalid object name while reading data out of an SQL Database

Hi all,
I'm a complete newbie on ASP.Net.

I want to get some data out of a SQLserver Database running on my system with SQL Server 2005 Express. The name of the Database is 'tempdb' and the table is called "Members". the SQLServer runs as Local System with the Windows account.

When I try to open the site, I always get the same error:
Invalid object name 'Members'

I don't know what to do anymore. I read a post, where anybody set the rights for the owner, but my database is running with the Windows account.

Here is the Code of the page so far:

<%@. Page Language="VB" Debug="True" Strict="True" %>
<%@. Import Namespace="System.Data" %>
<%@. Import Namespace="System.Data.SQlClient" %>
<script runat="server">
Sub Page_Load (ByVal Sender As Object, _
ByVal E As EventArgs)

Dim connStr As String
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;"
connStr += "database=tempdb;"
connStr += "Truster_Connection=yes"
Dim conn As New SQLConnection(connStr)
conn.Open()

Dim sql As String
sql = "SELECT COUNT (*) FROM Members"
Dim cmd As New SQLCommand(sql, conn)
Dim ergebnis As String
ergebnis = cmd.ExecuteScalar().toString()
Dim t As String
t = "Die Tabelle Members hat " & _
ergebnis & " Zeilen. <br>" & _
"Das Kommando lautet: " & _
cmd.CommandText & "<br>" & _
"Der Kommandotyp ist: " & _
cmd.CommandType

ausgabe.innerHTML = t

End Sub
</script>
<html><head><title>
Demo zu SQLCommand.ExecuteScalar
</title></head>
<body>
<h3>Demo zu SQLCommand.ExecuteScalar</h3>
<p runat="server" id="ausgabe" />
</body></html>

Thanks for your help an sorry for my english.

Greets
Flash_Prince

The problem is objects in tempdb is valid for limited time so your object the Member table does not exist. Microsoft provided the tempdb for SQL Server to be used to proccess complex queries and test queries so when you create a table if you did not drop it SQL Server will drop it at some point. Try the links below to download sample databases you can create and use with SQL Server 2005. The databases comes with tables but you can create your own tables so you can add the member table to any of the three database. Hope this helps.


http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&displaylang=en

http://www.microsoft.com/downloads/details.aspx?FamilyID=e719ecf7-9f46-4312-af89-6ad8702e4e6e&DisplayLang=en

|||

The problem is, that i want to use the database without entering the path of the database file in the sourcecode. When I use the nordwind database, all the sql queries are working very well. But if I use the Nordwind Database, I only know to connect by OleDB.

Can you tell me how to use a database in the way decribed above with a sql connection?

I hope, this is described understandable, cause my english is not the best.

|||

You need to create connection string and most of the information you need is covered in the two links below. Hope this helps.

http://www.connectionstrings.com

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000010.asp

|||The problem is in your connection string. You have a typo: "Truster_Connection=yes" should be "Trusted_Connection=yes".

Wednesday, March 21, 2012

Invalid IP address exception

I'm attempting to deploy an application that uses SQL Server 2005 Express as a back end. I installed the application on 6 or 7 machines, and on two of those machines I'm getting an error message I just don't understand. When I try to connect to the database, I'm getting "System Exception: An invalid IP address was specified.". I'm using the <machine name>\<instance name> to log into the server and I can ping the associated IP address. What's even more confusing is that I can log onto this instance from any of the other machines with no problem. I'm assuming the problem isn't with the SQL instance but a setting I'm missing on the machine, but for the life of me I can't find anything. Any help would be greatly appreciated.

Chris

Can you check this blog and see if there is any alias defined on the specific machine?

http://blogs.msdn.com/sql_protocols/archive/2007/01/07/connection-alias.aspx