I am passing a number value differentItems[2].Trim() which I then pass to delete a record.
I get an error on the first line: Cannot convert type Char
foreach (Corrections cor in correctionsManager.DeleteCorrectionsForInspection(differentItems[2].Trim()));
CorrectionsManager.cs
public string DeleteCorrectionsForInspection(string correctionID)
{
string returnGroup = "";
try
{
//Create the Parameter collection
IDataParameter[] paramCollection = new IDataParameter[1];
OleDbParameter p_correctionID = new OleDbParameter("CorrectionID", correctionID);
paramCollection[0] = p_correctionID;
returnGroup = db.ExecuteScalar(DELETE_CORRECTIONS_FOR_JOB, CommandType.Text, paramCollection).ToString();
return returnGroup;
}
catch (Exception ex)
{
//Indicates error condition
Logger.CustomLog.LoggingEventError(ex.Message, ex);
return returnGroup;
}
}
Corrections.cs
public int CorrectionID
{
get
{
return correctionID;
}
set
{
correctionID = value;
}
}
Loading
Sateesh ArvetiPosted Apr 21, 2009, 5:33 AM
your method DeleteCorrectionsForInspection() is returning a string.In foreach loop,u r using Corrections instance.It wont be possible to convert a member of string to Corrections instance.Either,you should use char (or) int datatype in place of Corrections (or) to convert string returned into a collection of chars (or) ints.
If you want still to access Corrections in foreach loop,than go for IEnumerable using below link:
http://msdn.microsoft.com/en-us/library/aa288257(VS.71).aspx