Link to home
Start Free TrialLog in
Avatar of ckrafthofer
ckrafthofer

asked on

Problem with Connection / Parameter:

Attempted to compile the following and received the ERROR:

'System.Data.SqlClient.SqlCommand' does not contain a definition for 'commandText' and no extension method 'commandText' accepting a first argument of type 'System.Data.SqlClient.SqlCommand' could be found

What's going on?
Avatar of Ganapathi
Ganapathi
Flag of India image

Please post your code to see exactly where you went wrong.
Avatar of ckrafthofer
ckrafthofer

ASKER

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using CSC.GWServices.Tool.TDR;
namespace CSC.GWServices.Tool.TDR.DA
{ [DataObject(true)]
  public class CallDetailTDRRecordDA
  public CallDetailTDRRecordDA()
  {}
  protected string GetDetailTDRData (  int ACTIVITY_ID, DateTime ACTIVITY_DATE, string ACTIVITY_NOTES, string TT_TEXT, string TT_TIMESTAMP, DateTime updateTime )
  {  SqlCommand command = new SqlCommand();
     SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Test_CONNECTION_Test"].ConnectionString);
     command.commandText = "SELECT ACTIVITY_ID, ACTIVITY_DATE, ACTIVITY_NOTES, TT_TEXT, TT_TIMESTAMP FROM TDR_LOG";
      command.CommandTimeout  = 1200;
      command.CommandType = CommandType.Text;
      string sOrder = string.Empty;
      try
      {   if (ACTIVITY_ID != null)      command.Parameters.Add(CreateParameter("@ACTIVITY_ID", SqlDbType.VarChar));      
            if (ACTIVITY_DATE != null) command.Parameters.Add(CreateParameter("@ACTIVITY_DATE", SqlDbType.DateTime));
            if (ACTIVITY_NOTES != null) command.Parameters.Add(CreateParameter("@ACTIVITY_NOTES", SqlDbType.VarChar));
        }
        catch (Exception e)
        {   throw new Exception(e.Message);
        }
     }
  }
}
ASKER CERTIFIED SOLUTION
Avatar of Ganapathi
Ganapathi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial