question

JeffStiegler-8414 avatar image
0 Votes"
JeffStiegler-8414 asked JeffStiegler-8414 commented

Error when joining 3 sql tables

When joining 3 SQL tables using the code below I receive the following error message.

System.Data.SqlClient.SqlException
HResult=0x80131904
Message=The multi-part identifier "fpapdoption.facct" could not be bound.
Source=.Net SqlClient Data Provider


  Dim strSelect1 = "SELECT fosterparent.facct, classify, l_code, sacct, last_name,   first_name, last_o, first_o, " &
                          "county, status, birth_date, birth_da_o, dl_no, dl_no_o, education, educ_s, race, race_o, fa_book, income, ladder, " &
                          "addr_mail, mar_status, l_code, pool_fence, religion, relig_o, ss_no, ss_no_o, sacct, spa_pict, ncer_date, " &
                          "fprecert.first_b, fprecert.first_1, first_2, last_b, last_1, last_2, " &
                          "fpadoption.ml_rec, fpadoption.ml_rec_o, fpadoption.ml_rec_b, fpadoption.ml_rec_1, fpadoption.ml_rec_2 " &
                          "FROM fosterparent " &
                          "JOIN fprecert ON fosterparent.facct = fprecert.facct " &
                          "JOIN fpadoption ON fosterparent.facct = fpapdoption.facct " &
                          "WHERE fosterparent.status2 = 'Approved' and (fosterparent.status = 'Apprvd-Active' or fosterparent.status = 'Cert.-Active')"
    
         Dim FieldName = String.Empty
    
         Dim objCommand1 As New SqlCommand(strSelect1, objConnection)
    
         ' Open connection if closed
         If objConnection.State = ConnectionState.Closed Then objConnection.Open()
    
         objSQLDataReader1 = objCommand1.ExecuteReader()

Any ideas?

dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered JeffStiegler-8414 commented

Replace fpapdoption with fpadoption.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.