By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,905 Members | 900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,905 IT Pros & Developers. It's quick & easy.

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

P: 10
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
Share this Question
Share on Google+
1 Reply


Frinavale
Expert Mod 5K+
P: 9,731
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.