ASP.NET 4.0 Login Website Part - 3 Database Scripting

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
15,363
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Mar 3, 2011

The third part of Login Website shows you the database scripting portion in C# in ASP.NET 4.0.

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (Shmv90)

  • in the line

    string cmdstr="select count(*) from Registration where UserName" * TextBoxUN.Text *;

    what operator have u used before and after TextBoxUN, its not at all visible please can u re write this line for me in ur replyto this message!! ...

  • @sanasz91 It's like this:

    string cmdstr = "Select count(*) from Registration where UserName" + TextBoxUN.Text + "'";

    Note that before semicolon at last there is single quote between two double quote....like " ' "

  • Hi Shmv90.... Great tutorial...!

    Was just wondering... When checking for existing UserName my "int temp" get a 0 (zero) for a new unique userName and any number greater than zero (1, 2, 3... consecutivly) for duplicate UserNames... What is the reason for that do you know?

    I just changed mine to "if (temp !=0)"

    When stepping through the code this works fine, however, when running the program the Response.Write("..."); does not show and the program continues to insert the duplicate UserName :-?

  • @brovashift The whole logic behind that check is to ensure unique username to all registered Users. So, you should use if (temp == 1) or if (temp > 0) in your if loop condition and put Response.Write inside that. Because if variable temp has value 1 or larger that means user exist with same username and user should get notify about that.

  • @Shmv90 Ahh yes of course... normally when a duplicate username is entered the user is notified and a new unique username would be entered, which would mean temp is always either 0 or 1 nd no more... but becaue I was entering the same user several times for testing, thats why I WS getting nmber greater than 1... :) Silly me!

    However, when a duplicate username is found the program still continues to insert the data into the database and the Response.Write does not show...?

  • @brovashift then you should use if (temp > 0) because you already have more than 1 same usernames in your database. Just use this in your if loop condition and see if you get your Response.Write message.

see all

All Comments (35)

Sign In or Sign Up now to post a comment!
  • Thanks a lottt!! ...=)

  • thanks you very very much ^^

  • ei ...is it applicable for visusal studio 2008?cause when i type the codes that u are typing i get an error codes PLS REPLY

  • Thank you so muchhhh!!!!!! Really APPRECIATE!!! <3

  • @Shmv90 Hi, ive set the if to > 0 but its still not working... Could it be because im using a MasterPage...?

  • I suppose you could redirect to a new page just to diply the message and then using a timer redirct again back o the Registration page... aftersay 5 sec..

    Anyone know how to do this??? Thread.Sleep(5000) doesnt seem to work, same problem as Respose.Write....

  • @brovashift I have replaced Response.Write with a Response.Redirect("Registratio­n.aspx"); which stops the incorrect data being entered into the db but I still cannot dispay a message to notify the user of whats happened or why the Registation form has been reset... Which would be very annoying to a user!

    Do you know of a way to notify the user after a Postback? Is it even possible?

    Thanks again, thumbs up!

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more