Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 December 29th, 2006, 09:27 PM
Registered User
 
Join Date: Dec 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default can't get dll file to compile

This question refers to the creation of dll files found in the book ASP.NET 1.1 with Visual Basic 2003. It has to do with the WroxUnited Application used in the book. My problem occurs in the following code.

Imports System
Imports System.Data
Imports System.Collections
Imports System.Configuration

Namespace WroxUnited

    Public Class DataAccessCode
        Public Sub New()
        End Sub
  Function Dates() As System.Data.IDataReader
Dim connectionString As String = ConfigurationSettings.AppSettings("ConnectionStrin g")
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )

Dim queryString As String = "SELECT [Games].[Date], [Games].[GameID] FROM [Games]"
 Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
  dbCommand.CommandText = queryString dbCommand.Connection = dbConnection

  dbConnection.Open
  Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavio r.CloseConnection)

  Return dataReader
End Function

This code just gives the Date and Location of the Games for the WroxUnited soccer team. It reads from a microsoft database that was supplied by the website. There is other code in this program but I believe this will give you enough of an example to tell what is wrong. Just before doing this program I did an HelloWorld program that compiled and worked very nicely. I was told to create a batch file using \bin to create this dll file. The batch file is as follows:

cd c:\BegASPNET11\WroxUnited
md bin
vbc /t:library /r:System.dll,System.Data.dll /out:bin/DataAccessCode.dll DataAcccessCode.vb
pause

When I try to compile my program with this batch file the vbc gives an error message that the ConfigurationSettings.AppSettings("ConfigurationSt ring") is obsolete and another method is used.

I don't know why this is happening could someone please help?

 
Old December 31st, 2006, 01:09 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Try using ConfigurationManager.AppSettings.Get("Configuratio nString");

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old January 2nd, 2007, 12:31 AM
Registered User
 
Join Date: Dec 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When I sustitute ConfigurationManager.AppSettings.Get("Configuratio nString") for the book's value of ConfigurationSettings.AppSettings("ConnectionStrin g") I get the error message that ConfigurationManager is undefined. In the web.config file there is no mention of ConfigurationManager. The web.config file seems like it is properly set up to accept the book's configurationString but there is something wrong somewhere either in the web.config file or the DataAccessCode.vb. i've listed the main part of the DataAccessCode.vb in the last message. I will now list what is in the web.config file.


---------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8" ?>

<configuration>

    <!--

         The <appSettings> section is used to configure application-specific configuration
         settings. These can be fetched from within apps by calling the
         "ConfigurationSettings.AppSettings(key)" method:

-->

        <appSettings>
            <add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\BegASPNET11\WroxUnited\WroxUnited.mdb"/>
         </appSettings>




    <system.web>

        <!--

            The <sessionState" section is used to configure session state for the application.
            It supports four modes: "Off", "InProc", "StateServer", and "SqlServer". The
            later two modes enable session state to be stored off the web server machine -
            allowing failure redundancy and web farm session state scenarios.

            <sessionState mode="InProc"
                          stateConnectionString="tcpip=127.0.0.1:42424"
                          sqlConnectionString="data source=127.0.0.1;trusted_connection=true"
                          cookieless="false"
                          timeout="20" />

        -->

        <!--

            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>

        -->

        <!--

            The <authentication> section enables configuration of the security authentication
            mode used by ASP.NET to identify an incoming user. It supports a "mode"
            attribute with four valid values: "Windows", "Forms", "Passport" and "None":

            The <forms> section is a sub-section of the <authentication> section,
            and supports configuring the authentication values used when Forms
            authentication is enabled above:

            <authentication mode="Windows">

                    <forms name=".ASPXAUTH"
                           loginUrl="login.aspx"
                           protection="Validation"
                           timeout="999999" />

             </authentication>

        -->


        <!--

            The <authorization> section enables developers/administrators to configure
            whether a user or role has access to a particular page or resource. This is
            accomplished by adding "<allow>" and "<deny>" sub-tags beneath the <authorization>
            section - specifically detailing the users/roles allowed or denied access.

            Note: The "?" character indicates "anonymous" users (ie: non authenticated users).
            The "*" character indicates "all" users.

            <authorization>
               <allow users="joeuser" />
               <allow roles="Admins" />
               <deny users="*" />
            </authorization>

        -->

    </system.web>

</configuration>

--------------------------------------------------------------------

If you can give me any help on this problem I would certainly appreciate it. Thank you.

Steven Cist
[email protected]



 
Old January 2nd, 2007, 01:10 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Hmmm I am stumped. In the VB applications I write I use:

ConfigurationSettings.AppSettings("[name]") to get the value from my web.config

and my web config appSettings section looks similar to yours so I do not know.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature





Similar Threads
Thread Thread Starter Forum Replies Last Post
why can't i compile this java file? poorguy Java Basics 1 June 11th, 2007 08:03 AM
Why won't my vb program compile to .dll file stevecist ASP.NET 1.0 and 1.1 Basics 0 January 26th, 2007 09:39 PM
how to compile to dll stzd8 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 November 22nd, 2006 11:28 PM
Not able to compile jasper jrxml file satyakishore Servlets 1 March 9th, 2006 05:58 PM
How to compile C# file - Please get me started gau404 C# 2 November 12th, 2005 05:29 AM





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