I have error "Object reference not set to an instance of an object" on this code. I've tried to run this code with SQL (PHP myadmin) and I can receive my data but this code doesn't not work.
For i = 0 To arr_pdetail.Length
    Dim cmdText = "Select price from tb_pdetail where category = @car"
    Using cmd = New MySqlCommand(cmdText, conn)
        cmd.Parameters.Add("@cat", MySqlDbType.VarChar).Value = arr_pdetail(i)
        Dim result = cmd.ExecuteScalar()
        If result Is Nothing Then
            MessageBox.Show("No category found")
        Else
            MessageBox.Show("Found category with price " & result.ToString())
        End If
    End Using
    'sum_cost = sum_cost + price
Next
 
     
     
    