Click here to Skip to main content
15,920,438 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionChart Fx Xaxis and Point Labels Pin
Mohamed Arif17-Jun-07 16:54
Mohamed Arif17-Jun-07 16:54 
QuestionData Type Pin
Socheat.Net17-Jun-07 15:43
Socheat.Net17-Jun-07 15:43 
AnswerRe: Data Type Pin
Sathesh Sakthivel17-Jun-07 16:52
Sathesh Sakthivel17-Jun-07 16:52 
GeneralRe: Data Type Pin
Socheat.Net17-Jun-07 17:23
Socheat.Net17-Jun-07 17:23 
GeneralRe: Data Type Pin
Sathesh Sakthivel17-Jun-07 17:28
Sathesh Sakthivel17-Jun-07 17:28 
GeneralRe: Data Type Pin
Socheat.Net17-Jun-07 17:41
Socheat.Net17-Jun-07 17:41 
GeneralRe: Data Type Pin
Sathesh Sakthivel17-Jun-07 18:01
Sathesh Sakthivel17-Jun-07 18:01 
QuestionWrong database values [modified] Pin
ASPnoob17-Jun-07 12:00
ASPnoob17-Jun-07 12:00 
Hi, the following code is supposed to validate a username using a MySQL database before it and other info of a new user is stored in a database. When I check to see the info that is sent to MySQL, I noticed that it was the default values that I had created for each of the fields in the database that show up. The code below ran just fine but it doesn't do what it was designed to do. Would you please take a look to see what is wrong with the code. At the moment I have yet to use any kind of validations on any of the fields? 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 strGoodPassword As String
        Dim strSQL As String
        strSQL = String.Empty

        myConnection = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myMembersdb;User=myUser; Password=myPassword;Option=3;")
        myCommand = New OdbcCommand(strInsert, myConnection)
        strSQL = String.Format("SELECT UserName FROM myTable WHERE (email='{0}');", txtUserName.Text)
        myCommand.CommandText = strSQL
        myCommand.CommandType = CommandType.Text
        myConnection.Open()
        strGoodPassword = CType(myCommand.ExecuteScalar, String)
        If Not strGoodPassword Is Nothing 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(?,?,?,?)"
            myCommand.Parameters.Add("@FirstName", txtFirst.Text)
            myCommand.Parameters.Add("@LastName", txtLast.Text)
            myCommand.Parameters.Add("@Password", txtPassword.Text)
            myCommand.Parameters.Add("@UserName", txtUserName.Text)
            myCommand.ExecuteNonQuery()
            myConnection.Close()

        End If
End Sub

de", txtUserName.Text)
myCommand.ExecuteNonQuery()
myConnection.Close()

End If
End Sub



-- modified at 18:05 Sunday 17th June, 2007
AnswerRe: Wrong database values Pin
Christian Graus17-Jun-07 12:02
protectorChristian Graus17-Jun-07 12:02 
AnswerRe: Wrong database values Pin
Guffa17-Jun-07 19:02
Guffa17-Jun-07 19:02 
GeneralRe: Wrong database values Pin
ASPnoob17-Jun-07 20:41
ASPnoob17-Jun-07 20:41 
QuestionFinding Control Pin
Tarik Guney17-Jun-07 8:10
Tarik Guney17-Jun-07 8:10 
AnswerRe: Finding Control Pin
Tarik Guney17-Jun-07 9:55
Tarik Guney17-Jun-07 9:55 
AnswerRe: Finding Control Pin
Guffa17-Jun-07 9:58
Guffa17-Jun-07 9:58 
AnswerRe: Finding Control Pin
Christian Graus17-Jun-07 10:13
protectorChristian Graus17-Jun-07 10:13 
GeneralRe: Finding Control Pin
Tarik Guney17-Jun-07 10:47
Tarik Guney17-Jun-07 10:47 
GeneralRe: Finding Control Pin
Christian Graus17-Jun-07 12:01
protectorChristian Graus17-Jun-07 12:01 
Questionauto sending mail Pin
mehran.asg17-Jun-07 8:08
mehran.asg17-Jun-07 8:08 
AnswerRe: auto sending mail Pin
Tarik Guney17-Jun-07 9:44
Tarik Guney17-Jun-07 9:44 
GeneralRe: auto sending mail Pin
mehran.asg17-Jun-07 11:01
mehran.asg17-Jun-07 11:01 
GeneralRe: auto sending mail Pin
Tarik Guney17-Jun-07 11:07
Tarik Guney17-Jun-07 11:07 
AnswerRe: auto sending mail Pin
RepliCrux17-Jun-07 13:19
RepliCrux17-Jun-07 13:19 
QuestionDisplaying two tables in a single Data Griid Pin
vijaybhasker17-Jun-07 7:50
vijaybhasker17-Jun-07 7:50 
AnswerRe: Displaying two tables in a single Data Griid [modified] Pin
Tarik Guney17-Jun-07 9:51
Tarik Guney17-Jun-07 9:51 
AnswerRe: Displaying two tables in a single Data Griid Pin
Saifi Hasan17-Jun-07 18:36
Saifi Hasan17-Jun-07 18:36 

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.