C# .NET - Cannot find column [MyDate]. - Asked By Daniel on 28-Mar-13 07:47 AM

Hi I want to compare the data entered in a textbox to the data I have in DataTable but I am getting this error: Cannot find column [Date].
T-Sql code:
<pre lang="sql">ALTER PROC [dbo].[getCreditCard]

   IF NOT EXISTS(SELECT CardNumber,NameOnCard,ExpiresEnd As MyDate FROM  [dbo].[CardBank] )
         PRINT N'Request failed!'
         return 0
          select * from [dbo].[CardBank]
          PRINT N'Request succeeded'
          return 1
 and c# code:

<pre lang="cs">DataTable dt = _CreditCardInfo.GetCreditCard().Tables[0];
       _CreditCardInfo.CardNumber = TextBoxCardNumber.Text.Trim();
       string dropDowlistYear = DropDownListYears.SelectedValue;
       string dropDowlistMonth = DropDownListMonth.SelectedValue;
       DataRow[] drCardNumber = dt.Select(&quot;CardNumber='&quot; + TextBoxCardNumber.Text.ToString().Trim() + &quot;'&quot;);
       DataRow[] drNameOnCard = dt.Select(&quot;NameOnCard='&quot; + TextBoxNameOnCard.Text.ToString() + &quot;'&quot;);
       DataRow[] drValidFrom = dt.Select(&quot;MyDate='&quot; + dropDowlistYear + &quot;/&quot; + dropDowlistMonth + &quot;'&quot;);
       //DataRow[] ExpiresEnd = dt.Select(&quot;ExpYear='&quot; + dropDowlistMonth1 + &quot;'&quot;);
       if (drCardNumber.Length &gt; 0 &amp;&amp; drNameOnCard.Length &gt; 0 &amp;&amp; drValidFrom.Length &gt; 0)
           LabelMessage.Text = &quot;The Card name or Card Number are invalid.&quot;;
           LabelMessage.ForeColor = Color.Red;

and this the code inside my class:
<pre lang="sql">public DataSet GetCreditCard()
        return SqlHelper.ExecuteDataset(SqlHelper.GetConnection(), &quot;[getCreditCard]&quot;);

As u can see I want to get it from Datatable.
Can someone help!
Danasegarane Arunachalam replied to Daniel on 29-Mar-13 01:15 PM
Does your table really contains the column called "MyDate" ?

Did you check that one. I hope the column is not missing,