Results 1 to 9 of 9

Thread: VB.NET | Finding Name with Email?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    5

    Question VB.NET | Finding Name with Email?

    Hi Guys,

    Here's my table:
    UserID Email Password NameandSurname Country
    1 example@domain.com 12345 Great Guy Turkey

    In this table, i show user's name on label using his email.

    I've tried Find with Rows count, find with rows, columns coordinate but they didn't work.

    What should i do? Can anyone help me?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: VB.NET | Finding Name with Email?

    Are you asking how to retrieve the data from the database or do you already have the data in a DataTable and you want to get it from there? Maybe you could show us an example of what you've already tried so we can point out where you're going wrong?

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    5

    Re: VB.NET | Finding Name with Email?

    Quote Originally Posted by jmcilhinney View Post
    Are you asking how to retrieve the data from the database or do you already have the data in a DataTable and you want to get it from there? Maybe you could show us an example of what you've already tried so we can point out where you're going wrong?
    Users login with own email and password. And after login, Main form opens and user's name will writes in label. But i can't get it. I get it with user's email.
    (Sorry for broken English )

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    5

    Re: VB.NET | Finding Name with Email?

    And there is no dataset in form but if it necessary, i'll add.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: VB.NET | Finding Name with Email?

    It's just a query with a WHERE clause. There are examples all over the place. Again, maybe you could show us what you've tried and we can help you fix it. That's much more worthwhile than our just writing your code for you.

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    5

    Re: VB.NET | Finding Name with Email?

    Dear jmcilhinney,

    Thanks for interest, but i don't know how to use WHERE and how to show result.

    Here's my code;

    Code:
                    Dim conn As MySqlConnection
                    conn = New MySqlConnection
                    conn.ConnectionString = "my connection string"
                    Try
                        conn.Open()
                    Catch myerror As MySqlException
                        'Error message (I'll do it.)
                    End Try
                    Dim myAdapter As New MySqlDataAdapter
                    Dim SQLQuery As String = "SELECT * FROM Kullanicilar WHERE Email" 'Don't know how to use "WHERE"
                    Dim myCommand As New MySqlCommand
                    myCommand.Connection = conn
                    myCommand.CommandText = SQLQuery
    
                    myAdapter.SelectCommand = myCommand
                    Dim myData As MySqlDataReader
                    myData = myCommand.ExecuteReader()
    
                    If myData.HasRows Then
                        'and I don't know show the result :/
                    End If

    and if you don't understand this affair, i tell it with a sample:

    First user writes his e-mail and presses Enter. And his name and surname will show in a label. Like "Forget Password"

    (I'll use it with My.Settings)


    Hoping you would help,Thanks,
    Emircan

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: VB.NET | Finding Name with Email?

    You don't know how to use a WHERE clause and have apparently made no effort to find out.

    http://www.bing.com/search?q=mysql+w...ZI&form=MOZSBR

    Two seconds searching the web and you've got examples. If you're not prepared to make that much effort then you're not going to get very far.

    As for showing the result, it really depends what you want. The easiest option is probably to populate a DataTable and bind that to a DataGridView. Follow the CodeBank link in my signature and check out my thread on Retrieving & Saving Data for the first part and the second part is a simple matter of setting the grid's DataSource property.

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,302

    Re: VB.NET | Finding Name with Email?

    I just read your last post more carefully. Obviously you don't want a grid. That CodeBank thread of mine that I directed you to also shows how to get data directly from a data reader.

  9. #9

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    5

    Re: VB.NET | Finding Name with Email?

    Very thanks man! It works very well! Thanks for your tip.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width