Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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 May 21st, 2006, 08:16 PM
Authorized User
 
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am looking at the source to learn from it.
I am also gonna use it as a basis for a real world application as well.

I am given a project revamp our Team's Web portal which is currently in a form of static HTML and MS Word or Excel pages.

I picked ASP.NET 2.0 right after I saw your book.

Aparting from learning from scratch, I find the given examples found in the book could have speed up my learning and development process.

I am planning to use Appointment Booking App as Notebook Booking Application.

Here's the description of what I am doing now.

We have 20 notebooks for loan to an organisation.
These notebooks are available for loan for staffs who needs to travel overseas, give a presentation or as a temporary replacement if their current machine breaks down.

I am using a Excel spreadsheet to have an overview of how many notebooks were loaned out, how many are available and how many are booked.

The Spreadsheet also shows me the earliest return date for the notebook for I can forecast whether I can cater to the next loan request.

As I am manually keying in the entries, I am wanting to have it dynamically available for my team members to do the same and have real-time results on the web portal.

I am still trying to tweak your source to suit my requirements I will let you know when I bang into something.

Emmanuel Alex


 
Old May 26th, 2006, 03:31 AM
Authorized User
 
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,


What does it mean when I get this error?

Server Error in '/appointment' Application.
--------------------------------------------------------------------------------

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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: 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)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): 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)]
   System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +734979
   System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +188
   System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820
   System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
   System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
   System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +130
   System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
   System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +496
   System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
   System.Web.UI.WebControls.SqlDataSourceView.Execut eSelect(DataSourceSelectArguments arguments) +1770
   System.Web.UI.WebControls.Repeater.GetData() +50
   System.Web.UI.WebControls.Repeater.CreateControlHi erarchy(Boolean useDataSource) +232
   System.Web.UI.WebControls.Repeater.OnDataBinding(E ventArgs e) +53
   System.Web.UI.WebControls.Repeater.DataBind() +72
   System.Web.UI.WebControls.Repeater.EnsureDataBound () +55
   System.Web.UI.WebControls.Repeater.OnPreRender(Eve ntArgs e) +12
   System.Web.UI.Control.PreRenderRecursiveInternal() +77
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

 
Old May 26th, 2006, 03:24 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Man, that is a lot of red stuff... I am getting epileptic attacks... ;)

ANyway, by default SQL Server is configure to only allow connections from the same machine, so it looks like you're trying to connect to a remote machine.

Look in the Start Menu under Microsoft SQL Server 2005 | Configuration | SQL Server Configuration Manager.

Then look under SQL Server 2005 Network Configuration. You'll see a number of protocols listed, most of them disabled. Unblcok the one you're using to connect (TCP or Named Pipes probably).

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old June 9th, 2006, 01:33 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to zheng
Default

Is this possible to deploy the database on an remote server and adjust the code to connect the remote database?

I tried to modify the "ConnectionStrings" section in web.config file as following:
 <connectionStrings>
    <add name="AppointmentBooking" connectionString="Data Source=remotedb;Initial Catalog=ASPNETDB;User ID=sa;Password=password;Integrated Security=true;User Instance=true" />
  </connectionStrings>

But it failed when a new user was signed up.The error page showed

Failed to update database "C:\INETPUB\WWWROOT\APPOINTMENTBOOKING\APP_DATA\AS PNETDB.MDF" because the database is read-only.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:\INETPUB\WWWROOT\APPOINTMENTBOOKING\APP_DATA\AS PNETDB.MDF" because the database is read-only.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Thank you very much


 
Old June 9th, 2006, 02:35 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, that's possible, but there are a few things you need to be aware of:

1. Your connection string is not valid. You mix up Integrated Security and SQL Server Authentication. Also, User Instance=True only applies to a SQL Server Express database.

Check www.connectionstrings.com for more information about proper connection strings.

2. Once you move the database to another location, you also need to reconfigure the providers. Right now, they simply use the aspnetdb.mdf file in the App_Data folder. However, since you moved the data base to a different server, you also need to change the configuration for the providers. Check out the following article for details about this:

http://weblogs.asp.net/scottgu/archi...25/423703.aspx

You can do what Scott did and redefining the LocalSqlServer connection string. This requires you to add two different connection strings entries in the web.config (with the same connection string): One called AppointmentBooking used by the app, and one called LocalSqlServer for the provider stuff.

Alternatively, you can completely reconfigure the providers so they use the AppointmentBooking string. For details how to do this, check out the web.config file from the WebShop application in the Instant Results book.

Hope this helps

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 16th, 2006, 08:36 AM
Eds Eds is offline
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello all

First, I'd like to say how useful this site has been to me!

But I am still having problems converting the appointment booking app to run off a full networked SQL server database. I have followed all the suggestions discussed here and I still can't make a connection to the database. I am new to ASP.NET so I'm a bit stuck for ideas...


Not sure if it's just down to my web.config being wrong;
<connectionStrings>

<add name="AppointmentBooking" connectionString="Data Source=IP address, port;Network Library=DBMSSOCN;Initial Catalog=appservicesdb;Integrated Security=SSPI;" />

<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=IP address, port;Network Library=DBMSSOCN;Initial Catalog=appservicesdb;Integrated Security=SSPI;"/>

</connectionStrings>

This is becoming a matter of some urgency as I would like to demonstrate the advantages of using a web app like this to my boss! All help gratefully received

Thanks

Paul
 
Old August 16th, 2006, 08:44 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Paul,

Can you provide a bit more detail?

Do you already have the database up and running at the full networked SQL server database? If so, what version is it? (SQL 2000 or SQL 2005)??

You may also need to look at your connection string. Take a look here for the proper format: http://www.connectionstrings.com/

Did you also change the rest of the web.config file? If so, can you post its code?

Finally, can you define "having problems" and "can't make a connection to the database"? are you getting an error? If so, what error is that?

Quick enough?? ;)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 16th, 2006, 09:14 AM
Eds Eds is offline
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar

That was a quick reponse!

To answer your questions;
I am using a SQL server 2005 database.

The only part of the web.config file i have changed is the code inside the <connection strings> tags, i have left the rest of web.config as it was.

I simply copied the app_data directory onto the SQL server machine (to c:/app_data/ and then attached the database to SQL server, is this the correct way to do it?

When I use the asp.net configuration too and try to test the connection i get this message:-"Provider Management

Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider."

I followed the guidelines on ScottGu's blog, and i went through all the stages fine, but still can't make the connection.

Any ideas?

Thanks for your time

Paul
 
Old August 16th, 2006, 09:27 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The appointment booking app is a bit tricky when it comes to the database configuration. Instead of its own database, it reuses the aspnetdb database.

So, to make the change, you'll indeed need to change both the connection string from the app (AppointmentBooking) as the localSqlServer one.

Can you successfully open the database on the remote server? And did you look at this: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=395

Can you post the *exact* code for your web.config (make sure you change IP addresses and passwords).

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old August 16th, 2006, 09:36 AM
Eds Eds is offline
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's my web.config file (without the IP's)

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <appSettings>
    <add key="BookingObjectNameSingular" value="Staff name" />
    <add key="BookingObjectNamePlural" value="Staff names" />
    <add key="RequireCommentsInRequest" value="False" />
    <add key="FirstAvailableWorkingHour" value="7" />
    <add key="LastAvailableWorkingHour" value="20" />
  </appSettings>
  <connectionStrings>
      <add name="AppointmentBooking" connectionString="Data Source=IP, port;Network Library=DBMSSOCN;Initial Catalog=ASPNETDB;Integrated Security=SSPI;" />

      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString="Data Source=IP, port;Network Library=DBMSSOCN;Initial Catalog=ASPNETDB;Integrated Security=SSPI;"/>
  </connectionStrings>
  <system.web>
        <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions
            where data loss can occur.
            Set explicit="true" to force declaration of all variables.
        -->
    <compilation debug="true" strict="false" explicit="true" />

    <roleManager enabled="true" />

    <pages theme="AppointmentBooking">
      <namespaces>
        <clear />
        <add namespace="System" />
        <add namespace="System.Collections" />
                <add namespace="System.Collections.Specialized" />
                <add namespace="System.Configuration" />
                <add namespace="System.Text" />
                <add namespace="System.Text.RegularExpressions" />
                <add namespace="System.Web" />
                <add namespace="System.Web.Caching" />
                <add namespace="System.Web.SessionState" />
                <add namespace="System.Web.Security" />
                <add namespace="System.Web.Profile" />
                <add namespace="System.Web.UI" />
                <add namespace="System.Web.UI.WebControls" />
                <add namespace="System.Web.UI.WebControls.WebParts" />
                <add namespace="System.Web.UI.HtmlControls" />
            </namespaces>
        </pages>
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
    <authentication mode="Forms">
      <forms loginUrl="~/Login.aspx" />
    </authentication>
        <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    </system.web>
  <location path="Management">
    <system.web>
      <authorization>
        <allow roles="Manager" />
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>

  <location path="CreateAppointment.aspx">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>

  <location path="CheckAvailability.aspx">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>

  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="smtp.YourProvider.com" port="25" />
      </smtp>
    </mailSettings>
  </system.net>
</configuration>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Appointment Booking KDSTECH BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 11 May 29th, 2008 12:46 AM
Appointment booking philblack1 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 January 25th, 2008 01:17 PM
Appointment Booking System newbie07 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 July 18th, 2007 08:32 AM
Modifications to Appointment Booking... mkumar BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 7 March 31st, 2007 01:51 AM
Appointment Booking Problem richardson167 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 February 26th, 2007 07:00 AM





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