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....
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 I have replaced Response.Write with a Response.Redirect("Registration.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?
@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.
@Shmv90 thanks for the reply, i only asked because its not a common practice (at least in all examples i´ve seen) but it´s important to verify if the postback event occurs... but when you click the event button, you know that it will be a postback itself... so every click events are Postbacks, right?? i´m confused... :p
int temp = Convert.ToInt32(userExist.ExecuteScalar().ToString());
im having error on this line it says: An expression of non-boolean type specified in a context where a condition is expected, near 'ID'. any one ? adv thx :))
Thanks for posting this tutorial... its been very helpful. I am however getting an error when i run the register page. I added an exception mge and was returned this... Insert Error:Syntax error in INSERT INTO statement. I am connecting to an Access DB and have changed the sqlcommand/connection to read OleDbConnection. Any ideas?
my code - string insCmd="INSERT INTO Registration (UserName, Password, EmailAddress, FullName, Country) VALUES (@UserName, @EmailAddress, @FullName, @Country)";
the only thing that dont work is the part of it dont tell you that you have a existing usersname... trying to figure that out.. the if(temp ==1) dont work. finding a way to compare it to the username and then the textbox input. maybe i can get it working there, good video man, but please help?
This has been flagged as spam show
Hi, I could not get this to work. I'm getting errors like:
int temp = Convert.ToInt32(userExist.ExecuteScalar().ToString());
im having error on this line it says: An expression of non-boolean type specified in a context where a condition is expected, near 'Name'.
catch(Exception er)
The variable 'er' is declared but never used?
Can anyone help me?
sucaro27 7 hours ago
Thanks a lottt!! ...=)
sanasz91 6 days ago
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 1 week ago
@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 " ' "
Shmv90 1 week ago
thanks you very very much ^^
PornjareanSeaya 2 weeks ago
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
clintonmc21 3 weeks ago
Thank you so muchhhh!!!!!! Really APPRECIATE!!! <3
SoulmateOranGes91 1 month ago
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 1 month ago
v nice i will give it a try :P
nasir2010khan 1 month ago
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 1 month ago
@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 1 month ago
@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 1 month ago
@brovashift I have replaced Response.Write with a Response.Redirect("Registration.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!
brovashift 1 month ago
@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.
Shmv90 1 month ago
@Shmv90 Hi, ive set the if to > 0 but its still not working... Could it be because im using a MasterPage...?
brovashift 1 month ago
why you use isPostback property in this case? Do you think you need it?
just a silly question...
rmas199 1 month ago in playlist Mais vídeos de Shmv90
@rmas199 Yeah, it's necessary to check that submit button's event code runs if there's postback occures.
Shmv90 1 month ago
@Shmv90 thanks for the reply, i only asked because its not a common practice (at least in all examples i´ve seen) but it´s important to verify if the postback event occurs... but when you click the event button, you know that it will be a postback itself... so every click events are Postbacks, right?? i´m confused... :p
rmas199 1 month ago
i have an error after this code:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegConnectionString"].ConnectionString);
it says that i must declare an object with "new"
??ß
BurakTR19 1 month ago
"NullReferenceException" is not defined ??
BurakTR19 1 month ago
i have a error in registration page is
Somthing bad happen
wich is written in to the catch
then what to do?
and how to solve it?
bhargav960143 1 month ago
int temp = Convert.ToInt32(userExist.ExecuteScalar().ToString());
im having error on this line it says: An expression of non-boolean type specified in a context where a condition is expected, near 'ID'. any one ? adv thx :))
fallensnowsnow 1 month ago
catch(Exception er)
The variable 'er' is declared but never used?
Owwnt 1 month ago
Hi
sorry for my english .......
(cndString, con) and Parameters get the same error message "does not exist in current context" Why? Can you help me? Thanks
and
loveroma71 2 months ago
Hi Guys, I tried to Register but i get the error message from catch(Exeption er)
any ideas to fix this prob??
Greetings from KOSOVA!!
try... catch (Exception er) { Response.Write("error, please try again!"); }
computingm 2 months ago
@computingm What is error saying..??
Shmv90 2 months ago
mine doesnt work :(
you used Catch (Exception er);
mines error
prinz419 3 months ago
Thanks for posting this tutorial... its been very helpful. I am however getting an error when i run the register page. I added an exception mge and was returned this... Insert Error:Syntax error in INSERT INTO statement. I am connecting to an Access DB and have changed the sqlcommand/connection to read OleDbConnection. Any ideas?
my code - string insCmd="INSERT INTO Registration (UserName, Password, EmailAddress, FullName, Country) VALUES (@UserName, @EmailAddress, @FullName, @Country)";
redshirtdecoy 3 months ago
@redshirtdecoy Did you try this:
string insCmd=@"INSERT INTO Registration (UserName, Password, EmailAddress, FullName, Country) VALUES (@UserName, @EmailAddress, @FullName, @Country)";
And then u also have to set values for that @ variables.
Shmv90 3 months ago
yeah, he if(temp ==1) doesn't work
ramuhuyu 4 months ago in playlist More videos from Shmv90
the only thing that dont work is the part of it dont tell you that you have a existing usersname... trying to figure that out.. the if(temp ==1) dont work. finding a way to compare it to the username and then the textbox input. maybe i can get it working there, good video man, but please help?
ItalianNatural 5 months ago
Everything works fine to me. People who want to see it better must use browser full screen.
shams3400 7 months ago
Zoooooooooooom men...
willnsub 8 months ago
Comment removed
garyqld 11 months ago