S
Sugandh Jain
Hi,
We have a stored procedure, that returns the set of rows of companies...
Following is the query in it.
Select
PMCompanyID AS [COMPANYID]
, TC.NAME AS [COMPANYNAME]
, TC.ShortName AS [SHORTNAME]
From
PM_Company AS PMC
INNER JOIN T_Company TC ON PMC.NOMSCompanyID = TC.CompanyID
WHERE
PMC.IsActive = 1
And in our c#, code we use the following method to populate the corresponding CompanyNameID object.
In the method below, we are using the index of the column to set a particular property value of the company object.
company = new CompanyNameID();
int ID = offset + 0;
int fullName = offset + 1;
int ShortName = offset + 2;
company.ID = Convert.ToInt32(row[ID]);
company.FullName = Convert.ToString(row[fullName]);
company.ShortName = Convert.ToString(row[ShortName]);
return company;
So, now, if some one changes the order of columns in the select query, the code written above will go wrong.
So, I want to set the property values of company Object not by index of column in the query but by the column name of it.
How to do that? I u need more clarification on the question, please wirte to me at (e-mail address removed) or ping at jain_sugandh ( on yahoo messenger)
Regards,
Sugandh
We have a stored procedure, that returns the set of rows of companies...
Following is the query in it.
Select
PMCompanyID AS [COMPANYID]
, TC.NAME AS [COMPANYNAME]
, TC.ShortName AS [SHORTNAME]
From
PM_Company AS PMC
INNER JOIN T_Company TC ON PMC.NOMSCompanyID = TC.CompanyID
WHERE
PMC.IsActive = 1
And in our c#, code we use the following method to populate the corresponding CompanyNameID object.
In the method below, we are using the index of the column to set a particular property value of the company object.
company = new CompanyNameID();
int ID = offset + 0;
int fullName = offset + 1;
int ShortName = offset + 2;
company.ID = Convert.ToInt32(row[ID]);
company.FullName = Convert.ToString(row[fullName]);
company.ShortName = Convert.ToString(row[ShortName]);
return company;
So, now, if some one changes the order of columns in the select query, the code written above will go wrong.
So, I want to set the property values of company Object not by index of column in the query but by the column name of it.
How to do that? I u need more clarification on the question, please wirte to me at (e-mail address removed) or ping at jain_sugandh ( on yahoo messenger)
Regards,
Sugandh