Click here to Skip to main content
15,897,718 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: usercontrol caching Pin
Chetan Ranpariya18-Jun-07 23:52
Chetan Ranpariya18-Jun-07 23:52 
GeneralRe: usercontrol caching Pin
marky77719-Jun-07 0:10
marky77719-Jun-07 0:10 
GeneralRe: usercontrol caching Pin
Chetan Ranpariya19-Jun-07 0:14
Chetan Ranpariya19-Jun-07 0:14 
GeneralRe: usercontrol caching Pin
marky77719-Jun-07 0:50
marky77719-Jun-07 0:50 
AnswerRe: usercontrol caching Pin
Nouman Bhatti19-Jun-07 1:52
Nouman Bhatti19-Jun-07 1:52 
QuestionHow can we use multiline and New line character in asp.net Pin
Hemant Garg18-Jun-07 22:40
Hemant Garg18-Jun-07 22:40 
AnswerRe: How can we use multiline and New line character in asp.net Pin
wEb GuRu...18-Jun-07 23:28
wEb GuRu...18-Jun-07 23:28 
QuestionCode failed to validate username Pin
ASPnoob18-Jun-07 21:50
ASPnoob18-Jun-07 21:50 
Hi, I finally got my code to send a user's username and password to the database. However, it did not check to see if the username has already been taken and did not prompt the user for a new username like it was designed to. I will put in code to prevent sql injection and use other validations later. As for now I just want it to work. Please help point out the cause of this problem. Thank you in advance for your help

Private Sub lblRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblRegister.Click
    Dim myConnection As OdbcConnection
    Dim myCommand As OdbcCommand
    Dim strInsert As String
    Dim strSQL As String
    strSQL = String.Empty

    myConnection = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=myServer;Database=myDB;User=myUser; Password=myPW;Option=3;")
    strSQL = String.Format("SELECT UserName FROM myTable WHERE (UserName='{0}');", txtUserName.Text)
    myCommand = New OdbcCommand(strSQL, myConnection)
    myCommand.CommandType = CommandType.Text
    myConnection.Open()

    Dim result As Integer = myCommand.ExecuteNonQuery()
    If result > 0 Then
        lblMessage.Text = "That user name is already taken!"
        lblMessage.Text &= "  Please choose another user name."
    Else

        strInsert = "INSERT into myTable (FirstName,LastName,Password,UserName)values (?,?,?,?)"
        Dim myCommand1 As OdbcCommand = New OdbcCommand(strInsert, myConnection)
        myCommand1.CommandType = CommandType.Text
        myCommand1.Parameters.Add("@FirstName", txtFirst.Text)
        myCommand1.Parameters.Add("@LastName", txtLast.Text)
        myCommand1.Parameters.Add("@Password", txtPassword.Text)
        myCommand1.Parameters.Add("@UserName", txtUserName.Text)
        Dim result1 As Integer = myCommand1.ExecuteNonQuery()

        myConnection.Close()

    End If

    txtFirst.Text = ""
    txtLast.Text = ""
    txtUserName.Text = ""
    txtPassword.Text = ""
End Sub

AnswerRe: Code failed to validate username Pin
Chetan Ranpariya18-Jun-07 21:56
Chetan Ranpariya18-Jun-07 21:56 
GeneralRe: Code failed to validate username Pin
ASPnoob18-Jun-07 22:07
ASPnoob18-Jun-07 22:07 
AnswerRe: Code failed to validate username Pin
Chetan Ranpariya18-Jun-07 23:17
Chetan Ranpariya18-Jun-07 23:17 
AnswerRe: Code failed to validate username Pin
szukuro18-Jun-07 22:30
szukuro18-Jun-07 22:30 
QuestionItemInserted event & formview communication Pin
aitch4218-Jun-07 21:37
aitch4218-Jun-07 21:37 
Questionhow to get item template Pin
srinivassam18-Jun-07 21:31
srinivassam18-Jun-07 21:31 
AnswerRe: how to get item template Pin
Tarik Guney18-Jun-07 22:15
Tarik Guney18-Jun-07 22:15 
AnswerRe: how to get item template Pin
Nouman Bhatti19-Jun-07 1:58
Nouman Bhatti19-Jun-07 1:58 
QuestionRegarding Maverick.NET Pin
stkartik18-Jun-07 21:09
stkartik18-Jun-07 21:09 
QuestionHow to correct? Pin
Socheat.Net18-Jun-07 21:01
Socheat.Net18-Jun-07 21:01 
AnswerRe: How to correct? Pin
6-shooter18-Jun-07 21:15
6-shooter18-Jun-07 21:15 
GeneralRe: How to correct? Pin
MaheshSharma18-Jun-07 23:32
MaheshSharma18-Jun-07 23:32 
AnswerRe: How to correct? Pin
Venkatesh Mookkan18-Jun-07 21:18
Venkatesh Mookkan18-Jun-07 21:18 
GeneralRe: How to correct? Pin
Socheat.Net18-Jun-07 21:34
Socheat.Net18-Jun-07 21:34 
AnswerRe: How to correct? Pin
Jay_se18-Jun-07 21:19
Jay_se18-Jun-07 21:19 
GeneralRe: How to correct? Pin
Socheat.Net18-Jun-07 21:39
Socheat.Net18-Jun-07 21:39 
QuestionFrom browser itself print view..........., Pin
Member 387988118-Jun-07 21:00
Member 387988118-Jun-07 21:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.