Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2004, 06:03 PM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Server does not exist or access denied

I am trying to run the examples that came with the book and i keep getting this error.

I changed all the web.config file to include Server=(local)\SQLSERVER;user id=sa;password=; and the config files in the config folder to server=(local)\SQLSERVER;database=thephile;uid=sa; pwd=;

This is the error i get: An unexpected error has occurred on this page. The system administrators have been notified. Please feel free to contact us with the information surrounding this error.
The error occurred in: http://localhost/ThePhile/Default.aspx
Error Message: SQL Server does not exist or access denied.
--------------------------------------------------------------------------------
Stack Trace:
System.Data.SqlClient.SqlException: SQL Server does not exist or access denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at Wrox.WebModules.Data.DbObject.RunProcedure(String storedProcName, IDataParameter[] parameters, Int32& rowsAffected) in c:\wrox\thephile\modules\core\dbobject.cs:line 119 at Wrox.WebModules.Polls.Data.Questions.GetCurrentID( ) in C:\wrox\ThePhile\Modules\Polls2\Polls.Data\Questio ns.cs:line 94 at Wrox.WebModules.Polls.Business.Question.GetCurrent ID() in C:\wrox\ThePhile\Modules\Polls2\Polls.Business\Que stion.cs:line 129 at Wrox.WebModules.Polls.Web.Controls.User.Poll.DataB ind() in C:\wrox\ThePhile\Modules\Polls2\Poll.ascx.cs:line 123 at Wrox.WebModules.Polls.Web.Controls.User.Poll.Page_ Load(Object sender, EventArgs e) in C:\wrox\ThePhile\Modules\Polls2\Poll.ascx.cs:line 114 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain()

I know the server is working, as well as the sa account and the "thephile" database because i creadted a console ap in c# that just connected to the database, using both of the above strings, and it connected with no problem. I've even tried chganing the DBObject.cs file so that the connection string is hardcoded, but then i get other errors like Error Message: Could not find stored procedure 'sp_Polls_GetCurrentQuestionID'

Does anyone know why i can't get the sql connection to work?

 
Old January 25th, 2004, 01:51 PM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try creating a udl file to create your connection string, it's a bit old school, but it helps me out whenever i feel i'm overlooking something in my connection string.
To make the file, just create a text file, rename the extension file.udl. doubleclick on the file, make your settings, test the connection and then close it. reopen the file using notepad and copy the connection string leaving off the bit about the provider at the beginning.
let me know if that works for you

 
Old February 3rd, 2004, 04:21 AM
Registered User
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DANIESPES
Default

I'VE DE SAME ERROR, A FEW DAYS BEFORE EVERYTHINGS WAS RIGHT, NOW EVERYTHING IS WRONG, BUT I HAVE THE TEST ENVIRONMENT, AND IN THIS SITUATION IS OK, FROM MY COMPUTER BAD, COULD ANYBODY EXPLAINT TO ME?
THANKS

 
Old May 12th, 2004, 09:01 AM
Authorized User
 
Join Date: Apr 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

UVASID,
COPY THE CONNECTION STRING TO WHERE?
What do I use from this string:
----------------------
[oledb]
; Everything after this line is an OLE DB initstring
Provider=MSDASQL.1;Password=mypassword;Persist Security Info=True;User ID=sa;Extended Properties="DSN=COMPLAN;APP=Microsoft® Windows® Operating System;WSID=COMPLAN;Trusted_Connection=Yes"
---------------------
In the code.
 
Old May 12th, 2004, 10:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do you have a named instance of SQL Server? This is a bit unusual, especially for someone who is new to SQL Server. This is saying you have a named instance of SQL Server called "SQLSERVER", and it's running on the local computer:
(local)\SQLSERVER

If you don't know what I'm talking about, then try removing "\SQLSERVER" from this.

Also, if you didn't have SQL Server installed at the time you installed Visual Studio, you probably don't have the ASPNET user account set up in your SQL Server. This is needed if you want to use a trusted connection. If you use a trusted connection you don't need to specify a username and password.


Please don't try to use oledb. This is a less efficient, and more complex, solution. Stay with the SQL Server provider. You don't need any DSNs, SIDs, or anything like that.

Eric
 
Old May 13th, 2004, 10:52 AM
Authorized User
 
Join Date: Apr 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am now getting a problem with sp_Polls_GetCurrentQuestionID-could not find stored procedure. It is there as I can see it.
Dont really know if I've made progress. I installed SQL Server and then .NET. I hate being a newbie :(
 
Old May 13th, 2004, 10:18 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to read the other messages here. Some stored procs are missing from the DB creation script provided with the code download. In order to get them all you have to restore the database from the backup included in the code download.

Eric
 
Old May 14th, 2004, 06:04 AM
Authorized User
 
Join Date: Apr 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

englere,
the procedure is in my database.
here's the error:
----------------------------------
Page Error

An unexpected error has occurred on this page. The system administrators have been notified. Please feel free to contact us with the information surrounding this error.
The error occurred in: http://localhost/ThePhile/Default.aspx
Error Message: Could not find stored procedure 'sp_Polls_GetCurrentQuestionID'.

Stack Trace:
System.Data.SqlClient.SqlException: Could not find stored procedure 'sp_Polls_GetCurrentQuestionID'. at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Wrox.WebModules.Data.DbObject.RunProcedure(String storedProcName, IDataParameter[] parameters, Int32& rowsAffected) in C:\wrox\ThePhile\Modules\Core\DbObject.cs:line 106 at Wrox.WebModules.Polls.Data.Questions.GetCurrentID( ) in C:\wrox\ThePhile\Modules\Polls2\Polls.Data\Questio ns.cs:line 94 at Wrox.WebModules.Polls.Business.Question.GetCurrent ID() in c:\wrox\thephile\modules\polls2\polls.business\que stion.cs:line 129 at Wrox.WebModules.Polls.Web.Controls.User.Poll.DataB ind() in C:\wrox\ThePhile\Modules\Polls2\Poll.ascx.cs:line 123 at Wrox.WebModules.Polls.Web.Controls.User.Poll.Page_ Load(Object sender, EventArgs e) in C:\wrox\ThePhile\Modules\Polls2\Poll.ascx.cs:line 114 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain()

----------------------------------
Why it can't find it I dont know :(
 
Old May 16th, 2004, 10:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm guessing you populated your "ThePhile" DB using the script provided in the code download, right? That script does NOT have the bug fixes and additional SPs that were added to the DB backup file in the code download.

Your choices:
1) wipe out the DB and do a restore from the DB backup file included in the code download.
2) Use an updated set of scripts to clean out your DB and create everything you should have. I've made new 2 scripts: one deletion script, and one creation script.

I'm working on creating an updated version of ThePhile to include the missing pages and some essential security fixes. I'm not sure about distributing this because I can't offer a lot of support at this time. I might agree to release my changes on an "as is" basis...but I need to make sure that Wrox wouldn't have a problem with that.

Eric
 
Old June 3rd, 2004, 09:47 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm aslo having a similar problem to this one. I have created database call StaffDatabase and have a table called LOGIN and a stored procedure called Botec_GET_STAFF, the SP code is below


CREATE PROCEDURE Botec_GET_STAFF

@paramUsername nvarchar(15),
@paramPassword nvarchar(15)

AS

SET NOCOUNT ON

SELECT StaffID, Username FROM LOGIN WITH(NOLOCK)
WHERE Username = @paramUsername
AND [Password]=@paramPassword
SET NOCOUNT OFF

GO


and the c# code that I use to connect to the database is as below

namespace botec.DataAccess
{
using System.Data;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using System.EnterpriseServices;
using botec.Data;

    [
    ComVisible(true),
    Transaction(TransactionOption.Supported),
    Guid("DB95CBCB-A826-483e-A79C-6BB6F0D29517"),
    ConstructionEnabled(Default="server=local;database =StaffDatabase;uid=sa;pwd=****")
    ]

    public sealed class Login : ServicedComponent
    {
        private string connectString = "";

        public Login()
        {
        }

        protected override void Construct(string s)
        {
            connectString = s;
        }


        [ AutoComplete ]
        public void GetLogin(string username, out StaffLoginData dsLogin)
        {
            SqlServerAccess sqlServer = new SqlServerAccess(connectString);

            try
            {
                dsLogin= new StaffLoginData();
                sqlServer.CommandText = "Botec_GET_STAFF";
                sqlServer.Command.Parameters.Add(sqlServer.GetSqlP arameter("@userName", SqlDbType.VarChar, 15, username, ParameterDirection.Input));
                sqlServer.DataAdapter.TableMappings.Add("Table", dsLogin.LoginDetails.TableName);
                sqlServer.GetDataSet(dsLogin);
            }
            catch
            {
                throw;
            }
            finally
            {
                sqlServer.Dispose();
            }
        }

    }

}

I would be gratefull if you can help since this has been playing with my head for the past 2 weeks. I am using SQL2000. I have tried the SP3a patch but in vain

Thank you,
Sidney

Sidney





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server does not exist or access denied happygv SQL Server 2000 0 April 9th, 2008 02:27 AM
SQL Server does not exist or access denied jennypretty Classic ASP Databases 3 May 18th, 2007 11:43 AM
SQL Server does not exist or access denied. jimbeam36 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 November 3rd, 2004 08:51 AM
SQL Server does not exist or access denied haidee_mccaffrey Classic ASP Databases 19 June 28th, 2004 09:38 PM
SQL Server does not exist or access denied. nitinmailbox All Other Wrox Books 1 June 25th, 2003 06:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.