title: SQL 2003 Error - System.ArgumentException: Column 'Quantity' does not belong to table 1
body: <p>I'm using Visual Studio to build a piece of software that connects to my MSSQL 2003 Server. I am trying to Pull data from a table in order to use it in a stored procedure and am receiving the following error.</p>
  
  <p>System.ArgumentException: Column 'Quantity' does not belong to table TMS_Campaign.</p>
  
  <p>I have double checked that the column name is spelt correctly and that the case is correct. I have also tried to do an IISRESET.exe and simply rebooting the machine at the recommendation from some other post.</p>
  
  <pre><code>Sub SendMail()
      Dim SQL As String
      Dim oDS As New Data.DataSet
      Dim oDT As New Data.DataTable
      Dim ServerID As Integer = GetServerID()
  
  
      SQL = "exec sp_Check " &amp; ServerID
      oDT = GetRS(SQL)
  
      If oDT.Rows.Count = 0 Then
          'if there is NO item set status = Ready and EXIT
          SQL = "UPDATE TMS_Server" &amp; vbCrLf &amp;
                   "SET StatusID = 3," &amp; vbCrLf &amp;
                   "StatusDateTime = GetDate()" &amp; vbCrLf &amp;
                   "WHERE SID = " &amp; ServerID
          AddLineToLog("No Schedule - " &amp; Now)
          Application.DoEvents()
          Wait(5)
      Else
          'set IDs
          G.MID = oDT.Rows(0)("MID")
          G.CID = oDT.Rows(0)("CID")
          G.LID = oDT.Rows(0)("LID")
          G.SFID = oDT.Rows(0)("SFID")
          G.LastID = oDT.Rows(0)("LastID")
          G.BatchSize = oDT.Rows(0)("BatchSize")
          G.Quantity = oDT.Rows(0)("Quantity")
  
          'GET LIST
  
          ExecuteSQL("sp_GetOrderID_V4 " &amp; G.LID &amp; "," &amp; G.MID &amp; "," &amp; G.Quantity)
  </code></pre>
  
  <p>EDIT - Code from comment:</p>
  
  <pre><code>CREATE proc sp_CheckForCampaign 
  @ServerID int as 
   SELECT TOP 1 MID, L.LID, L.AKID, L.AKLevel, C.CID, C.Warm, SFID, LaunchDateTime, LastID, BatchSize, BatchInterval 
  FROM TMS_Mailings M 
  INNER JOIN TMS_Campaign C ON M.CID = C.CID 
  INNER JOIN TMS_Server S ON M.SID = S.SID 
  INNER JOIN TMS_List L ON M.LID = L.LID 
  WHERE LaunchDateTime &lt; GetDate() 
  AND M.SID = @ServerID 
  AND M.StatusID IN (1,2) -- Scheduled, Mailing 
  ORDER BY LaunchDateTime 
  GO
  </code></pre>