If the data you've posted is the entire content of your tables, then it's no wonder you're getting this error. Where is the parent row in
tblA
for the first row in
tblB
? According to the definition of your relationship, there should be a row with
Clid = 1
, but there isn't.
Correct the data in your database, and then set up
a FOREIGN KEY constraint[
^] between the tables to prevent this sort of problem from occurring again.
If those are your real table names, then you should strongly consider changing them to something more meaningful - for example,
Customers
and
Orders
. It will make your life much easier when you come back to maintain this code later.