Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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 July 19th, 2004, 02:56 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to RPG SEARCH
Default Database connection?

Hi there i started to develope my first application based on the teaching within the asp.net 1.1 for beginners book.... i am using chapter 17 to create a login of my own and its gone wrong i dont understand why! please can anyone offer help?

error:

Compiler Error Message: BC30002: Type 'OLEDBConnection' is not defined.

code:

<%@ Page Language="VB" %>
<script runat="server">

    ' Insert page code here
    '

    Sub Login_Click(sender As Object, e As EventArgs)

        Dim strConn as string ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("database/store.mdb") & ";"
            Dim Conn as New OLEDBConnection(strConn)
            Conn.Open()
            Dim strSQL as string = "SELECT UserPass FROM UserDetails WHERE UserName = '" & txtAdminLogin.Text & "'"
            Dim Cmd as New OLEDBCommand(strSQL,Conn)
                'Create a datareader, connection object
            Dim Dr as OLEDBDataReader = Cmd.ExecuteReader(System.Data.CommandBehaviour.Clo seConnection)
                'Get the first row and check the password
            If Dr.Read()
                If Dr("UserPass").ToString = txtAdminPasswd.text Then
                FormAuthentication.RedirectFromLoginPage(txtAdminL ogin.text, false)
                Else
                lblLoginMsg.text = "Sorry that was an invalid password"
                End If
                Else
                lblLoginMsg.text = "Sorry that user name was not found"
                End If
                Dr.Close

    End Sub

</script>
<html>
<head>
    <link href="../includes/shop.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <form runat="server">
        <p align="center">
            <img src="images/logo.gif" />
        </p>
        <p align="center">
            Admin&nbsp;Login:
            <asp:TextBox id="AdminLogin" runat="server"></asp:TextBox>
            <br />
            Admin Password:
            <asp:TextBox id="AdminPasswd" runat="server" TextMode="Password"></asp:TextBox>
        </p>
        <p align="center">
            <asp:Label id="lblLoginMsg" runat="server" forecolor="#ff000"></asp:Label>
        </p>
        <p align="center">
            <asp:Button id="btnLogin" onclick="Login_Click" runat="server" Text="Login"></asp:Button>
        </p>
        <p align="center">
            Copyright 2004 dj-store
        </p>
    </form>
</body>
</html>


cheers.... i dont know if i am cut out for this application developing malarky

__________________
David Jenkins
 
Old July 19th, 2004, 11:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

how it doesnt work?! do u get any error?
But I guess u miss someting there.
Code:
FormsAuthentication.SetAuthCookie(AdminLogin.Text, false);
HTH.

Always:),
Hovik Melkomian.
 
Old July 20th, 2004, 03:27 AM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to RPG SEARCH
Default

is this in the web.config as i have asked it to set a cookie called .djstoreadmin
cheers for helping

 
Old July 28th, 2004, 08:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Umm, am I missing something? The error here is saying he didn't define OLEDBConnection .. which he might not have if he didn't import the namespace.... I'd look at that first...


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee





Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Connection to Access Database reachsevar ASP.NET 2.0 Basics 1 November 28th, 2007 08:56 AM
Database Connection oneillg PHP Databases 1 October 17th, 2007 04:48 PM
Database Connection kapi.goel SQL Language 2 February 14th, 2006 07:01 PM
database connection Nitin_sharma Classic ASP Databases 1 February 8th, 2005 10:23 AM





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