ckrafthofer
asked on
Problem with Connection / Parameter:
Attempted to compile the following and received the ERROR:
'System.Data.SqlClient.Sql Command' does not contain a definition for 'commandText' and no extension method 'commandText' accepting a first argument of type 'System.Data.SqlClient.Sql Command' could be found
What's going on?
'System.Data.SqlClient.Sql
What's going on?
Please post your code to see exactly where you went wrong.
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(Configuratio nManager.C onnectionS trings["Te st_CONNECT ION_Test"] .Connectio nString);
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(Cre ateParamet er("@ACTIV ITY_ID", SqlDbType.VarChar));
if (ACTIVITY_DATE != null) command.Parameters.Add(Cre ateParamet er("@ACTIV ITY_DATE", SqlDbType.DateTime));
if (ACTIVITY_NOTES != null) command.Parameters.Add(Cre ateParamet er("@ACTIV ITY_NOTES" , SqlDbType.VarChar));
}
catch (Exception e)
{ throw new Exception(e.Message);
}
}
}
}
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(Configuratio
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(Cre
if (ACTIVITY_DATE != null) command.Parameters.Add(Cre
if (ACTIVITY_NOTES != null) command.Parameters.Add(Cre
}
catch (Exception e)
{ throw new Exception(e.Message);
}
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.