ARTICLE

How to Create Asynchronous Login Form in ADO.NET

Posted by Munesh Sharma Articles | ADO.NET in VB.NET May 11, 2011
In this article , we will learn how to create the Asynchronous login form in ADO.NET.
Reader Level:

We known that, when we click a submit button on web page then all content of web page post to server. But user want only user name and password post to the server. it is only done by AJAX (Asynchronous JavaScript and XML). In this article we create a login web page using AJAX that check the value of login form on the database server.

There are various steps to create login web page through Ajax:

  • Step first, Go Visual studio >> File >> Web application.

  • Step second, Design web form with ScriptManager and Update panel:

    design-web-form.gif

  • Step third Create Table in Sql sever 2008:

    Data-base.gif

  • Write these code:

    Imports System.Data.SqlClient
    Imports
    System.IO 
    Partial
    Public Class _Default
        Inherits System.Web.UI.Page 
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
        End Sub
     
        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
            Dim str As String = "Data Source=MCNDESKTOP14;Initial Catalog=studentinfo; uid=sa;pwd=wintellect"
            Dim con As SqlConnection
            con = New SqlConnection(str)
            con.Open() 
            str = "Select * from login where name='" & TextBox1.Text & "' and   Password1 ='" & TextBox2.Text & "';"
            Dim com As New SqlCommand(str, con)
            Dim rd As SqlDataReader = com.ExecuteReader()
            If rd.Read() Then
                Label1.Text = "Vaild user and password"
            Else
      
                Label1.Text = "inVaild user and password"
            End If
           
    End
    Sub
      
    End
    Class

Output:
                 output-login.gif
            
                  output-login2.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor