[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

SQL Server Does Not Exist... & ASP.NET/VB.NET 1.1

Hey,

I have a web app on my local computer and I can't seem to get it to talk with my database. I keep getting that error message in the title of this message.  I have SQL Server 2K running locally. My web app is running locally with IIS 5.

**** Homepage code ************
.....

' Create Instance of Connection and Command Object
        Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
        Dim myConnection2 As String = ConfigurationSettings.AppSettings("ConnectionString")
        Trace.Warn("Connection String: ", myConnection2)

        Dim myCommand As SqlCommand = New SqlCommand("GetHomepageProducts", myConnection)

        ' Mark the Command as a SPROC
        myCommand.CommandType = CommandType.StoredProcedure

        ' Execute the command
        myConnection.Open()
        Dim result As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

        repFeatureProduct.DataSource = result
        repFeatureProduct.DataBind()
.....

**********************

**** web.config *****

<add key="ConnectionString" value="server=localhost;uid=cmlawson;pwd=balboa;database=DPX;" />

*******************

I've also tried the following string in the web.config file:

<add key="ConnectionString" value="data source=localhost;initial catalog=DPX;integrated security=SSPI;persist security info=False;Trusted_Connection=Yes;"></add>
            

In my SQL Server Enterprise Manager, under the 'Users' tab of my dB called 'DPX' I have the following users:

NAME                              LOGIN ACCESS                         DATABASE ACCESS
---------------------------------------------------------------------------
BUILTIN/Administrators     BUILTIN/Administrators         Permit
cmlawson                        cmlawson                            Permit
dbo                                 DELL1/Chad Michael Lawson  Permit
DELL1/ASPNET                 DELL1/ASPNET                     Permit
DELL1/IUSR_DELL1           DELL1/IUSR_DELL1               Permit
Guest                                                                        Via group membership

I've read almost all the posts related to this topic on this site and others but I can't seem to figure out what's going wrong so I'm hoping someone can help me out?

If I'm leaving out any relevant info please ask me and I'll do what I can to give it too you. Keep in mind I'm not a whiz in SQL Server but can get around OK in asp.net.

~cml
0
cmlawson
Asked:
cmlawson
1 Solution
 
bsdotnetCommented:
<configuration>
  <appSettings>
     <add key="ConnectionString" value="server=localhost;database=testdb;User ID=xxx;Password=xxxx" />
  </appSettings>
   ...




0
 
meomarCommented:
Try browsing the database from the VS.net server browser and add the database from there. Then look at the connection property and check the connection string. Also, when installing the DB did you specify an instance name?
0
 
cmlawsonAuthor Commented:
bsdotnet: tried your suggestion but it didn't work out for me.

meomar: tried that out and worked great. I've never used Visual Studio in that manner and I think it's a great little trick! After I compared the connection string in VS.NET with mine the only difference was my data source was set to 'localhost' and it's was set to 'DELL1'. I don't know why this matters but I'm guessing it's a permission's thing. Anyway, all said and done, I have a new trick in my bag now and I also have my problem solved.

Thanks so much!

~cml
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now