dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: i am new in ASP.NET plz help me...!

  1. #1
    Join Date
    Aug 2008
    Posts
    1

    i am new in ASP.NET plz help me...!

    i am new in ASP.NET....!

    and i want to create login page in ASP.NET...!

    i download a code from a tutorial website of ASP.NET

    but i have lots of problem when i modified the code...!
    Code:
    <%@ Page Language="VB" %>
    <%@ import namespace="System.Data" %>
    <%@ import namespace="System.Data.OleDb" %>
    
    <script runat="server">
    
      Public Sub Login_Click(ByVal sender As Object, ByVal e As EventArgs)
    
        Dim userId As Integer
            Dim reader As OleDbDataReader
            'Dim connectionString = _
            'ConfigurationSettings.ConnectionStrings("MyConnectionString")
            'Dim conn As New SqlConnection(connectionString)
            'Dim command As New SqlCommand("dbo.Authenticate", conn)
           
           
            'my conncection
            Dim strConnection As String = "Provider=Microsoft.Jet.OleDb.4.0;" & _
                            "data source=E:\asadaspdotnet\nwind.mdb;"
            Dim objConnection As New OleDbConnection(strConnection)
            Dim command As New OleDbCommand("login.Authenticate", objConnection)
    
    
           
           
    
        ' Set the command type to stored procedure
        command.CommandType = CommandType.StoredProcedure
    
        ' Set @Username and @Password
            command.Parameters.Add("@Username", _
                    OleDbType.Char, 256).Value = Username.Text
            command.Parameters.Add("@Password", _
                OleDbType.Char, 256).Value = Password.Text
    
        ' Open the connection and execute the reader
            objConnection.Open()
           
    
    ' i have error at this point
            reader = command.ExecuteReader()
    
        ' Read the value we're looking for
        reader.Read()
    
        userId = Integer.Parse(reader("UserId"))
    
        ' Close connections
        reader.Close()
            objConnection.Close()
    
        ' Did we find a user?
        If (userId > 0) Then
            FormsAuthentication.RedirectFromLoginPage(Username.Text, _
                                                      False)
        Else
          Status.Text = "Invalid Credentials: Please try again"
    
        End If
    
      End Sub
    
    </script>
    
    <html>
      <body style="FONT-FAMILY: Verdana">
    
      <H1>Enter your username/password</H1>
    
      <form id="Form1" runat="server">
        Username: <asp:textbox id="Username" runat="server" />
        <br>
        Password: <asp:textbox id="Password" runat="server" />
        <p>
        <asp:button id="Button1"
                    text="Check if Member is Valid"
                    onclick="Login_Click" runat="server"/>
      </form>
    
      <font color="red" size="6">
        <asp:label id="Status" runat="server"/>
      </font>
    
      </body>
    </html>
    if u find any error then sove it

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Welcome to DevX
    Quote Originally Posted by asad_black@hotm
    if u find any error then sove it
    That is not how it works.

    If you have a problem, state the specific problem indicating the line, or lines, or code causing the problem.

Similar Threads

  1. Replies: 27
    Last Post: 02-11-2016, 06:29 AM
  2. Replies: 8
    Last Post: 11-27-2007, 08:28 AM
  3. SS Tab Controls in ASP.net (PLz urgent one)
    By samtron in forum ASP.NET
    Replies: 5
    Last Post: 02-21-2006, 01:46 AM
  4. Advantages of ASP.NET over Java/ASP
    By Tricia in forum .NET
    Replies: 0
    Last Post: 04-11-2003, 09:34 PM
  5. Free ASP.NET Web Matrix Design/Editor Tool Released
    By ASPSmith Training in forum dotnet.announcements
    Replies: 0
    Last Post: 06-18-2002, 03:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center