I am trying to select data from a database in the based on a condition....Its just a simple select SQL query

SELECT playerid FROM player WHERE username = 'John'

Therefore, from this I would like to store John's playerid to a variable and then use this variable.

Below is my attempt but not getting anywhere:

Dim da As OleDb.OleDbDataAdapter
        Dim sql2 As String
        Dim test
        sql2 = "SELECT playerid FROM player WHERE username = 'John'"

        test= New OleDb.OleDbDataAdapter(sql2, myCon)

  
        'AddData("Player1ID, Player2ID", "'" & tbxPlayerID.Text & "', '" & test & '")

What would be the best way to achieve what I'm trying to do? maybe there is a much simple method.

im an new to this so, any help would be much appreciated. i am using Microsoft Visual Basic 2008 Express Edition....

Thanks

Then this question should have been posted in the .net forum ,not here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.