Cannot Convert Error Message - Newbie

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created the following:

[WebMethod]
public SubjectProperty[] UpdateSubjectProperty(string _CDKey, string
_UIKey, string _Subject)
{
SubjectProperty[] _SubjectProperty =
_SearchController.UpdateSubjectProperty(_CDKey, _UIKey, _Subject);

return _SubjectProperty;

Which in turn is linked to:

public void UpdateSubjectProperty(string _CDKey, string _UIKey,
SubjectProperty _Subject)
{


try
{

SQLStatement _SQLStatement = new SQLStatement();
_SQLStatement.StoredProceedure = "SUBJECT_Update_Properties";

SqlParameter _CD = new SqlParameter("@CDKey", SqlDbType.Char);
_CD.Direction = ParameterDirection.Input;
_CD.Value = _CDKey;
_SQLStatement.AddParameter(_CD);

SqlParameter _User = new SqlParameter("@UIKey", SqlDbType.Char);
_User.Direction = ParameterDirection.Input;
_User.Value = _UIKey;
_SQLStatement.AddParameter(_User);

SqlParameter _ProjectName = new SqlParameter("@ProjectName",
SqlDbType.VarChar);
_ProjectName.Direction = ParameterDirection.Input;
_ProjectName.Value = _Subject.ProjectName;
_SQLStatement.AddParameter(_ProjectName);

SqlParameter _Builder = new SqlParameter("@Builder", SqlDbType.VarChar);
_Builder.Direction = ParameterDirection.Input;
_Builder.Value = _Subject.Builder;
_SQLStatement.AddParameter(_Builder);

SqlParameter _CommunityName = new SqlParameter("@CommunityName",
SqlDbType.VarChar);
_CommunityName.Direction = ParameterDirection.Input;
_CommunityName.Value = _Subject.Community;
_SQLStatement.AddParameter(_CommunityName);

SqlParameter _MasterPlan = new SqlParameter("@MasterPlan",
SqlDbType.VarChar);
_MasterPlan.Direction = ParameterDirection.Input;
_MasterPlan.Value = _Subject.MasterPlan;
_SQLStatement.AddParameter(_MasterPlan);

SqlParameter _Accessibility = new SqlParameter("@Accessibility",
SqlDbType.VarChar);
_Accessibility.Direction = ParameterDirection.Input;
_Accessibility.Value = _Subject.Accessibility;
_SQLStatement.AddParameter(_Accessibility);

SqlParameter _LandPlan = new SqlParameter("@LandPlan", SqlDbType.VarChar);
_LandPlan.Direction = ParameterDirection.Input;
_LandPlan.Value = _Subject.LandPlan;
_SQLStatement.AddParameter(_LandPlan);

SqlParameter _HouseType = new SqlParameter("@HouseType",
SqlDbType.VarChar);
_HouseType.Direction = ParameterDirection.Input;
_HouseType.Value = _Subject.HouseType;
_SQLStatement.AddParameter(_HouseType);

SqlParameter _MinimumSize = new SqlParameter("@MinimumSize",
SqlDbType.VarChar);
_MinimumSize.Direction = ParameterDirection.Input;
_MinimumSize.Value = _Subject.MinSize;
_SQLStatement.AddParameter(_MinimumSize);

SqlParameter _LotSize = new SqlParameter("@LotSize", SqlDbType.VarChar);
_LotSize.Direction = ParameterDirection.Input;
_LotSize.Value = _Subject.LotSize;
_SQLStatement.AddParameter(_LotSize);

SqlParameter _LotDimension = new SqlParameter("@LotDimension",
SqlDbType.VarChar);
_LotDimension.Direction = ParameterDirection.Input;
_LotDimension.Value = _Subject.LotDimension;
_SQLStatement.AddParameter(_LotDimension);

SqlParameter _Density = new SqlParameter("@Density", SqlDbType.VarChar);
_Density.Direction = ParameterDirection.Input;
_Density.Value = _Subject.Density;
_SQLStatement.AddParameter(_Density);

SqlParameter _ConstructionLender = new
SqlParameter("@ConstructionLender", SqlDbType.VarChar);
_ConstructionLender.Direction = ParameterDirection.Input;
_ConstructionLender.Value = _Subject.ConstructionLender;
_SQLStatement.AddParameter(_ConstructionLender);

SqlParameter _OpenDate = new SqlParameter("@OpenDate", SqlDbType.VarChar);
_OpenDate.Direction = ParameterDirection.Input;
_OpenDate.Value = _Subject.OpenDate;
_SQLStatement.AddParameter(_OpenDate);

SqlParameter _Map = new SqlParameter("@Map", SqlDbType.VarChar);
_Map.Direction = ParameterDirection.Input;
_Map.Value = _Subject.Map;
_SQLStatement.AddParameter(_Map);

SqlParameter _REPORT = new SqlParameter("@REPORT", SqlDbType.VarChar);
_REPORT.Direction = ParameterDirection.Input;
_REPORT.Value = _Subject.Report;
_SQLStatement.AddParameter(_REPORT);

SqlParameter _SHADOW = new SqlParameter("@SHADOW", SqlDbType.VarChar);
_SHADOW.Direction = ParameterDirection.Input;
_SHADOW.Value = _Subject.Shadow;
_SQLStatement.AddParameter(_SHADOW);

SqlParameter _LEADER = new SqlParameter("@LEADER", SqlDbType.VarChar);
_LEADER.Direction = ParameterDirection.Input;
_LEADER.Value = _Subject.Leader;
_SQLStatement.AddParameter(_LEADER);

_SQLConnection.StartTransaction("Subject");
int _Result = _SQLConnection.UpdateData(_SQLStatement);
_SQLConnection.EndTransaction();

}
catch(MGException mgex)
{
throw mgex;
}
catch(Exception e)
{
throw new MGException(MGException.LoggingLevelTypes.On,"Unable to update
Subject Property",e);
}

When I attempt to build the project I get the following error message:

"Argument '3' cannot convert from 'String' to
'System.InfoTools.BITTools.Search.Subject Property'." What does that mean?
 
Look at your method:

public void UpdateSubjectProperty(string _CDKey, string _UIKey,
SubjectProperty _Subject)

The error message seems to indicate that somewhere in your code you're
trying to call this method passing 3 strings. This does not match the
signature, since the method expects the third argument to be of type
System.InfoTools.BITTools.Search.Subject Property.

Take a look at all calls to this method in your code. There should be one
passing invalid parameters.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


Anthony D. Law said:
I have created the following:

[WebMethod]
public SubjectProperty[] UpdateSubjectProperty(string _CDKey, string
_UIKey, string _Subject)
{
SubjectProperty[] _SubjectProperty =
_SearchController.UpdateSubjectProperty(_CDKey, _UIKey, _Subject);

return _SubjectProperty;

Which in turn is linked to:

public void UpdateSubjectProperty(string _CDKey, string _UIKey,
SubjectProperty _Subject)
{


try
{

SQLStatement _SQLStatement = new SQLStatement();
_SQLStatement.StoredProceedure = "SUBJECT_Update_Properties";

SqlParameter _CD = new SqlParameter("@CDKey", SqlDbType.Char);
_CD.Direction = ParameterDirection.Input;
_CD.Value = _CDKey;
_SQLStatement.AddParameter(_CD);

SqlParameter _User = new SqlParameter("@UIKey", SqlDbType.Char);
_User.Direction = ParameterDirection.Input;
_User.Value = _UIKey;
_SQLStatement.AddParameter(_User);

SqlParameter _ProjectName = new SqlParameter("@ProjectName",
SqlDbType.VarChar);
_ProjectName.Direction = ParameterDirection.Input;
_ProjectName.Value = _Subject.ProjectName;
_SQLStatement.AddParameter(_ProjectName);

SqlParameter _Builder = new SqlParameter("@Builder", SqlDbType.VarChar);
_Builder.Direction = ParameterDirection.Input;
_Builder.Value = _Subject.Builder;
_SQLStatement.AddParameter(_Builder);

SqlParameter _CommunityName = new SqlParameter("@CommunityName",
SqlDbType.VarChar);
_CommunityName.Direction = ParameterDirection.Input;
_CommunityName.Value = _Subject.Community;
_SQLStatement.AddParameter(_CommunityName);

SqlParameter _MasterPlan = new SqlParameter("@MasterPlan",
SqlDbType.VarChar);
_MasterPlan.Direction = ParameterDirection.Input;
_MasterPlan.Value = _Subject.MasterPlan;
_SQLStatement.AddParameter(_MasterPlan);

SqlParameter _Accessibility = new SqlParameter("@Accessibility",
SqlDbType.VarChar);
_Accessibility.Direction = ParameterDirection.Input;
_Accessibility.Value = _Subject.Accessibility;
_SQLStatement.AddParameter(_Accessibility);

SqlParameter _LandPlan = new SqlParameter("@LandPlan", SqlDbType.VarChar);
_LandPlan.Direction = ParameterDirection.Input;
_LandPlan.Value = _Subject.LandPlan;
_SQLStatement.AddParameter(_LandPlan);

SqlParameter _HouseType = new SqlParameter("@HouseType",
SqlDbType.VarChar);
_HouseType.Direction = ParameterDirection.Input;
_HouseType.Value = _Subject.HouseType;
_SQLStatement.AddParameter(_HouseType);

SqlParameter _MinimumSize = new SqlParameter("@MinimumSize",
SqlDbType.VarChar);
_MinimumSize.Direction = ParameterDirection.Input;
_MinimumSize.Value = _Subject.MinSize;
_SQLStatement.AddParameter(_MinimumSize);

SqlParameter _LotSize = new SqlParameter("@LotSize", SqlDbType.VarChar);
_LotSize.Direction = ParameterDirection.Input;
_LotSize.Value = _Subject.LotSize;
_SQLStatement.AddParameter(_LotSize);

SqlParameter _LotDimension = new SqlParameter("@LotDimension",
SqlDbType.VarChar);
_LotDimension.Direction = ParameterDirection.Input;
_LotDimension.Value = _Subject.LotDimension;
_SQLStatement.AddParameter(_LotDimension);

SqlParameter _Density = new SqlParameter("@Density", SqlDbType.VarChar);
_Density.Direction = ParameterDirection.Input;
_Density.Value = _Subject.Density;
_SQLStatement.AddParameter(_Density);

SqlParameter _ConstructionLender = new
SqlParameter("@ConstructionLender", SqlDbType.VarChar);
_ConstructionLender.Direction = ParameterDirection.Input;
_ConstructionLender.Value = _Subject.ConstructionLender;
_SQLStatement.AddParameter(_ConstructionLender);

SqlParameter _OpenDate = new SqlParameter("@OpenDate", SqlDbType.VarChar);
_OpenDate.Direction = ParameterDirection.Input;
_OpenDate.Value = _Subject.OpenDate;
_SQLStatement.AddParameter(_OpenDate);

SqlParameter _Map = new SqlParameter("@Map", SqlDbType.VarChar);
_Map.Direction = ParameterDirection.Input;
_Map.Value = _Subject.Map;
_SQLStatement.AddParameter(_Map);

SqlParameter _REPORT = new SqlParameter("@REPORT", SqlDbType.VarChar);
_REPORT.Direction = ParameterDirection.Input;
_REPORT.Value = _Subject.Report;
_SQLStatement.AddParameter(_REPORT);

SqlParameter _SHADOW = new SqlParameter("@SHADOW", SqlDbType.VarChar);
_SHADOW.Direction = ParameterDirection.Input;
_SHADOW.Value = _Subject.Shadow;
_SQLStatement.AddParameter(_SHADOW);

SqlParameter _LEADER = new SqlParameter("@LEADER", SqlDbType.VarChar);
_LEADER.Direction = ParameterDirection.Input;
_LEADER.Value = _Subject.Leader;
_SQLStatement.AddParameter(_LEADER);

_SQLConnection.StartTransaction("Subject");
int _Result = _SQLConnection.UpdateData(_SQLStatement);
_SQLConnection.EndTransaction();

}
catch(MGException mgex)
{
throw mgex;
}
catch(Exception e)
{
throw new MGException(MGException.LoggingLevelTypes.On,"Unable to update
Subject Property",e);
}

When I attempt to build the project I get the following error message:

"Argument '3' cannot convert from 'String' to
'System.InfoTools.BITTools.Search.Subject Property'." What does that
mean?
 
Back
Top