I know there are tools available to rectify this, but somehow i cannot make out the mistake(s) that disallowed the retrieval of records, despite 2 hours of trying and referencing.
Can anyone help me with this? Im using VS 2008 btw.
SELECT pc.product_category_id, pc.product_category_name,
pi.product_image_id, pi.product_image_filename,
qr.qrcode_id, qr.qrcode_code, *
FROM Product AS p
INNER JOIN ProductCategory AS pc ON p.product_category_id = pc.product_category_id
INNER JOIN ProductImage AS pi ON p.product_image_id = pi.product_image_id
INNER JOIN QRCode AS qr ON p.qrcode_id = qr.qrcode_id
WHERE p.product_id = '" & DropDownList2.Text & "'"
First, manually check that the record you want to acquire and join exists…
If you get records for all of these, than you can be sure your joins are working. If not, are you missing records, or need to use LEFT JOINs?
So your next check should be that you’re passing the correct value to your SQL query…
Are you also sure that you need
'around the ID? this indicates strings, and IDs are more normally integers.Finally, look at parameterised queries, rather than building up the string manually.