469,612 Members | 1,639 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,612 developers. It's quick & easy.

Getting Error: The multi-part identifier "Table.Field" could not be bound.

I am recieving this error from my code:
The multi-part identifier "PAR.UniqueID" could not be bound.
The multi-part identifier "Salary.UniqueID" could not be bound.
The multi-part identifier "PAR.UniqueID" could not be bound.
The multi-part identifier "PAR.PAR_Status" could not be bound.
The multi-part identifier "Salary.New_Salary" could not be bound.
The multi-part identifier "Salary.UniqueID" could not be bound.
The multi-part identifier "PAR.UniqueID" could not be bound.
The multi-part identifier "PAR.PAR_StatusFROM" could not be bound.
Invalid column name 'PAR'.

Expand|Select|Wrap|Line Numbers
  1. SqlConnection adoConnSal = new SqlConnection("server=DEL-CD212; uid=sa;" +
  2.                     "pwd=graver; database=PAR");
  3.          adoConnSal.Open();
  4.  
  5.  
  6.          string sqlSal = "SELECT Salary.New_Salary, Salary.UniqueID, PAR.UniqueID, PAR.PAR_Status";
  7. sqlSal += "FROM Salary, PAR WHERE PAR.UniqueID=Salary.UniqueID AND PAR.UniqueID='100002' AND PAR.PAR_Status= 'current'";
  8.  
  9.          SqlCommand adoCmdSal = new SqlCommand(sqlSal, adoConnSal);
  10.  
  11.          SqlDataReader adoDRSal = adoCmdSal.ExecuteReader();
  12.  
  13.          if (adoDRSal.HasRows)
  14.          {
  15.              while (adoDRSal.Read())
  16.              {
  17.                  TextBox1.Text = (adoDRSal["Salary.New_Salary"].ToString());
  18.              }
  19.          }
  20.  
  21.          adoDRSal.Close();
  22.          adoDRSal.Dispose();
  23.          adoCmdSal.Dispose();
  24.          adoConnSal.Close();
  25.          adoConnSal.Dispose();
  26.  
  27.  
I can't figure out what the issue is. I know the SQL works because I ran it in SQL Server. It is giving the error at line 11. Thanks.
Jun 27 '07 #1
1 8982
Frinavale
9,735 Expert Mod 8TB
Hi MKnoll217!

Humor me and try changing:
Expand|Select|Wrap|Line Numbers
  1. tring sqlSal = "SELECT Salary.New_Salary, Salary.UniqueID, PAR.UniqueID, PAR.PAR_Status";
  2. sqlSal += "FROM Salary, PAR WHERE PAR.UniqueID=Salary.UniqueID AND PAR.UniqueID='100002' AND PAR.PAR_Status= 'current'";
to:

Expand|Select|Wrap|Line Numbers
  1. tring sqlSal = "SELECT Salary.New_Salary, Salary.UniqueID, PAR.UniqueID, PAR.PAR_Status";
  2. sqlSal += " FROM Salary, PAR WHERE PAR.UniqueID=Salary.UniqueID AND PAR.UniqueID='100002' AND PAR.PAR_Status= 'current'";
Jun 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by deko | last post: by
3 posts views Thread by yb | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.