I've been looking everywhere for an answer to a simple question, but i'm having issues, so i thought i'd join and post here.
I'm having issues with a simple concept. I load information from a SQL database, and i want to add a 'Passport' link URL relating to column cells called 'name'. It basically selects the name, and inserts it into the link fields to be opened. But i cant find a way to work it.
I thought i could do it with something like:

Public Shared Sub retriveDataToDataGrid()        
Dim names() As String
            Dim lnk As New DataGridViewLinkColumn()
            Dim query As String = "SELECT * FROM data"
            Dim connection As New MySqlConnection(connStr)
            Dim da As New MySqlDataAdapter(query, connection)
            Dim ds As New DataSet()
            If da.Fill(ds) Then
                Form2.DataGridView1.DataSource = ds.Tables(0)
                For x = 0 To Form2.DataGridView1.Rows.Count - 1
                    names(x) = Convert.ToString(Form2.DataGridView1.Item(2, x).Value)
                    lnk.Text = "C:\" & names(x)".jpg"
                Next x
                lnk.HeaderText = "Passport"
                lnk.UseColumnTextForLinkValue = True
            End If
        Catch ex As Exception
        End Try
    End Sub

But i thought wrong and i'm getting null exceptions from the loop.
How could i do this (is there another way)?
Thanks for help in advance.

Try this:

dim cmd as new sqlcommand("select * from users",c.con)
if(read()) then
end if

c & con is an object of class and connection respectively.
textbox1.text is the name of field in which you want to retrieve data from your database.