Junior Spellweaver
- Joined
- Oct 26, 2007
- Messages
- 108
- Reaction score
- 0
Hello everyone I've been making a game using vb.net 2010 EE and have gotten to the part where I want to save/load all of the game data eg, money
Up to now I have created my registration system and gotten it to login successfully by selecting usernames and passwords.
Now though I am trying to retrieve the information I have in my database and have the text display in a label.
I've tried to do this a few ways but cannot figure out how to only get the data from a row which has the username thats logged in.
I have it so it also fills a datagridview as I tried it that way but I still cant figure out how to select specific cells
Up to now I have created my registration system and gotten it to login successfully by selecting usernames and passwords.
Now though I am trying to retrieve the information I have in my database and have the text display in a label.
I've tried to do this a few ways but cannot figure out how to only get the data from a row which has the username thats logged in.
I have it so it also fills a datagridview as I tried it that way but I still cant figure out how to select specific cells
Code:
Dim SQLCOM As String = "SELECT * FROM users"
'this is the string im trying to get my value with. I dont know how to make it select a value from a column where the row is username and then write that value as a label
Dim GetGames As String = "SELECT * FROM users WHERE username='" & LBL_loggedinuser.Text & "'"
Dim sqlCommand As New MySqlCommand
Dim adapter As MySqlDataAdapter
Dim table As DataTable
Dim connectionstring As String = "server=*******; user id=gamedev; password=******; database=gamedev;"
Try
adapter = New MySqlDataAdapter(SQLCOM, connectionstring)
table = New DataTable
adapter.Fill(table)
DataGridView1.DataSource = table
Catch ex As Exception
MsgBox(ex.ToString)
End Try