Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 22, 2012 01:42 PM by Richey
Member
306 Points
523 Posts
Apr 17, 2012 02:43 AM|LINK
Hi,
I have below code for 1 productfamily. It's work fine.
DataSet1.TotalRevenueByMonthRow total = dataSet1.TotalRevenueByMonth.NewTotalRevenueByMonthRow();
total.productfamily = productFamily[0];
dataSet1.TotalRevenueByMonth.AddTotalRevenueByMonthRow(total);
But, I want total.productfamily (type: System.Guid) having two value. The idea is like:-
total.productfamily = productFamily[0] or total.productfamily = productFamily[1];
How can i put it in the correct coding ways?
Please advise.
Thank you.
Regards,
Micheale
Star
13403 Points
2531 Posts
Apr 17, 2012 03:22 AM|LINK
total.productfamily will need to be a data type which con contain multiple values. A List would be my choice.
Apr 17, 2012 03:27 AM|LINK
Hi Paul,
Could you please give me a sample of code?
Appreciate for your kind help.
Apr 17, 2012 06:04 AM|LINK
I have change syste.Guid to be Guid[] for the function, but i having issue on bold section. I can't perform using equal sign.
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.Guid[] productfamily {
get {
try {
return ((global::System.Guid[])(this[this.tableTotalRevenueByMonth.productfamilyColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'productfamily\' in table \'TotalRevenueByMonth\' is DBNull.", e); }
set {
this[this.tableTotalRevenueByMonth.productfamilyColumn] = value;
299 Points
79 Posts
Apr 17, 2012 11:19 AM|LINK
This will be useful.
http://msdn.microsoft.com/en-us/library/system.data.strongtypingexception.aspx
Apr 18, 2012 01:52 AM|LINK
I am stuck in the bold section section as below:-
public global::System.Data.DataColumn[] productfamilyColumn {
return this.columnproductfamily; // show error: Cannot implicity convert type 'System.Data.DataColumn' to 'System.Data.DataColumn[]'
Apr 18, 2012 09:36 AM|LINK
I manage to resolved the problem until this stage, but i got error for this line:-
Error: Cannot set Expression property due to circular reference in the expression.
dataSet1.TotalRevenueByMonth.productfamilyColumn.Expression = " productfamily in ('" + filterByProductFamily2.TrimStart(',') + "')";
Please Advise.
Apr 18, 2012 01:04 PM|LINK
My current solution:-
total.productfamily is Guid []
productFamily is Guid[].
If productFamily having 1 Guid, then it's work fined. But if Guid>1, then the total all show nil.
What's wrong with my below code?
for (int i = 1; i <= 10; i++)
{
total.totalcategory = i;
total.financialyear = year;
total.financialmonth = month;
total.accountmanagerid = (filterByAccountManager) ? accountManagerId : Guid.Empty;
total.aegionid = (filterByARegion) ? aRegionId : Guid.Empty;
total.abuid = (filterByABu) ? aBuId : Guid.Empty; total.productfamily = productFamily;
Apr 19, 2012 01:10 AM|LINK
Which piece of code is doing the wrong thing?
Is it AddTotalRevenueByMonthRow? Can you show the code that is giving an unexpected result?
Apr 19, 2012 01:18 AM|LINK
Thank you very much for your kind reply & help again.
Here it go:-
http://forums.asp.net/t/1794451.aspx/1?DataSet+Relations+with+filter+using+productfamily+in+item+a+item+b+item+c+
Finally i figure out the problem is occur at the post above.
For the function request above by you as below:-
public void AddTotalRevenueByMonthRow(TotalRevenueByMonthRow row) {
this.Rows.Add(row);
public TotalRevenueByMonthRow AddTotalRevenueByMonthRow(
int totalcategory, string name, int financialmonth,
int financialyear, System.Guid[] productfamily,
System.Guid accountmanagerid,
string accountmanager,
int countdownregion, System.Guid avbuid, System.Guid avregionid,
string currencycode_rc,
double initial_rcCoS,
double initial_rc,
double annual_rcCoS,
double annual_rc,
double rental_rcCoS,
double rental_rc,
double service_rcCoS,
double service_rc,
double training_rcCoS,
double training_rc,
double gross_rc,
double cos_rc,
double net_rc,
double ytd_initial_rcCoS,
double ytd_annual_rcCoS,
double ytd_rental_rcCoS,
double ytd_service_rcCoS,
double ytd_training_rcCoS,
double ytd_initial_rc,
double ytd_annual_rc,
double ytd_rental_rc,
double ytd_service_rc,
double ytd_training_rc,
double ytd_gross_rc,
double ytd_cos_rc,
double ytd_net_rc,
string opportunitytypename) {
TotalRevenueByMonthRow rowTotalRevenueByMonthRow = ((TotalRevenueByMonthRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
totalcategory, name,financialmonth, financialyear,
productfamily, accountmanagerid, accountmanager,
countdownregion, avbuid, avregionid, currencycode_rc,
initial_rcCoS, initial_rc, annual_rcCoS, annual_rc,
rental_rcCoS, rental_rc, service_rcCoS, service_rc,
training_rcCoS, training_rc, gross_rc, cos_rc, net_rc, ytd_initial_rcCoS,
ytd_annual_rcCoS, ytd_rental_rcCoS, ytd_service_rcCoS, ytd_training_rcCoS,
ytd_initial_rc, ytd_annual_rc, ytd_rental_rc, ytd_service_rc, ytd_training_rc,
ytd_gross_rc, ytd_cos_rc, ytd_net_rc, opportunitytypename};
rowTotalRevenueByMonthRow.ItemArray = columnValuesArray;
this.Rows.Add(rowTotalRevenueByMonthRow);
return rowTotalRevenueByMonthRow;
int totalcategory, string name,
int financialmonth,
int financialyear, System.Guid[] productfamily, System.Guid accountmanagerid,
string accountmanager, int countdownregion, System.Guid avbuid, System.Guid avregionid,
string currencycode_rc, double initial_rcCoS, double initial_rc,
double annual_rcCoS, double annual_rc,
double rental_rcCoS, double rental_rc,
double service_rcCoS, double service_rc,
double ytd_training_rc, double ytd_cos_rc,
totalcategory, name, financialmonth, financialyear, productfamily, accountmanagerid, accountmanager, countdownregion, avbuid, avregionid, currencycode_rc, initial_rcCoS, initial_rc, annual_rcCoS, annual_rc, rental_rcCoS, rental_rc, service_rcCoS, service_rc, training_rcCoS, training_rc, null, cos_rc, null, ytd_initial_rcCoS, ytd_annual_rcCoS, ytd_rental_rcCoS, ytd_service_rcCoS, ytd_training_rcCoS, ytd_initial_rc, ytd_annual_rc, ytd_rental_rc, ytd_service_rc, ytd_training_rc,null, ytd_cos_rc, null, opportunitytypename};
Thank You.
micnie2020
Member
306 Points
523 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 17, 2012 02:43 AM|LINK
Hi,
I have below code for 1 productfamily. It's work fine.
DataSet1.TotalRevenueByMonthRow total = dataSet1.TotalRevenueByMonth.NewTotalRevenueByMonthRow();
total.productfamily = productFamily[0];
dataSet1.TotalRevenueByMonth.AddTotalRevenueByMonthRow(total);
But, I want total.productfamily (type: System.Guid) having two value. The idea is like:-
total.productfamily = productFamily[0] or total.productfamily = productFamily[1];
How can i put it in the correct coding ways?
Please advise.
Thank you.
Regards,
Micheale
Paul Linton
Star
13403 Points
2531 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 17, 2012 03:22 AM|LINK
total.productfamily will need to be a data type which con contain multiple values. A List would be my choice.
micnie2020
Member
306 Points
523 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 17, 2012 03:27 AM|LINK
Hi Paul,
Could you please give me a sample of code?
Appreciate for your kind help.
Thank you.
Regards,
Micheale
micnie2020
Member
306 Points
523 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 17, 2012 06:04 AM|LINK
Hi,
I have change syste.Guid to be Guid[] for the function, but i having issue on bold section. I can't perform using equal sign.
Please advise.
Thank you.
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.Guid[] productfamily {
get {
try {
return ((global::System.Guid[])(this[this.tableTotalRevenueByMonth.productfamilyColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'productfamily\' in table \'TotalRevenueByMonth\' is DBNull.", e); }
}
set {
this[this.tableTotalRevenueByMonth.productfamilyColumn] = value;
}
}
rakeshreddym
Member
299 Points
79 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 17, 2012 11:19 AM|LINK
Hi,
This will be useful.
http://msdn.microsoft.com/en-us/library/system.data.strongtypingexception.aspx
micnie2020
Member
306 Points
523 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 18, 2012 01:52 AM|LINK
Hi,
I am stuck in the bold section section as below:-
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::System.Data.DataColumn[] productfamilyColumn {
get {
return this.columnproductfamily; // show error: Cannot implicity convert type 'System.Data.DataColumn' to 'System.Data.DataColumn[]'
}
}
Please advise.
Thank you.
Regards,
Micheale
micnie2020
Member
306 Points
523 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 18, 2012 09:36 AM|LINK
Hi,
I manage to resolved the problem until this stage, but i got error for this line:-
Error: Cannot set Expression property due to circular reference in the expression.
dataSet1.TotalRevenueByMonth.productfamilyColumn.Expression = " productfamily in ('" + filterByProductFamily2.TrimStart(',') + "')";
Please Advise.
Thank you.
micnie2020
Member
306 Points
523 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 18, 2012 01:04 PM|LINK
Hi,
My current solution:-
total.productfamily is Guid []
productFamily is Guid[].
If productFamily having 1 Guid, then it's work fined. But if Guid>1, then the total all show nil.
What's wrong with my below code?
Please Advise.
Thank you.
for (int i = 1; i <= 10; i++)
{
DataSet1.TotalRevenueByMonthRow total = dataSet1.TotalRevenueByMonth.NewTotalRevenueByMonthRow();
total.totalcategory = i;
total.financialyear = year;
total.financialmonth = month;
total.accountmanagerid = (filterByAccountManager) ? accountManagerId : Guid.Empty;
total.aegionid = (filterByARegion) ? aRegionId : Guid.Empty;
total.abuid = (filterByABu) ? aBuId : Guid.Empty;
total.productfamily = productFamily;
dataSet1.TotalRevenueByMonth.AddTotalRevenueByMonthRow(total);
}
Paul Linton
Star
13403 Points
2531 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 19, 2012 01:10 AM|LINK
Which piece of code is doing the wrong thing?
Is it AddTotalRevenueByMonthRow? Can you show the code that is giving an unexpected result?
micnie2020
Member
306 Points
523 Posts
Re: System.Data.StrongTypingException' System.Guid {System.Data.StrongTypingException}
Apr 19, 2012 01:18 AM|LINK
Hi Paul,
Thank you very much for your kind reply & help again.
Here it go:-
http://forums.asp.net/t/1794451.aspx/1?DataSet+Relations+with+filter+using+productfamily+in+item+a+item+b+item+c+
Finally i figure out the problem is occur at the post above.
Please Advise.
For the function request above by you as below:-
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void AddTotalRevenueByMonthRow(TotalRevenueByMonthRow row) {
this.Rows.Add(row);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public TotalRevenueByMonthRow AddTotalRevenueByMonthRow(
int totalcategory, string name, int financialmonth,
int financialyear, System.Guid[] productfamily,
System.Guid accountmanagerid,
string accountmanager,
int countdownregion, System.Guid avbuid, System.Guid avregionid,
string currencycode_rc,
double initial_rcCoS,
double initial_rc,
double annual_rcCoS,
double annual_rc,
double rental_rcCoS,
double rental_rc,
double service_rcCoS,
double service_rc,
double training_rcCoS,
double training_rc,
double gross_rc,
double cos_rc,
double net_rc,
double ytd_initial_rcCoS,
double ytd_annual_rcCoS,
double ytd_rental_rcCoS,
double ytd_service_rcCoS,
double ytd_training_rcCoS,
double ytd_initial_rc,
double ytd_annual_rc,
double ytd_rental_rc,
double ytd_service_rc,
double ytd_training_rc,
double ytd_gross_rc,
double ytd_cos_rc,
double ytd_net_rc,
string opportunitytypename) {
TotalRevenueByMonthRow rowTotalRevenueByMonthRow = ((TotalRevenueByMonthRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
totalcategory, name,financialmonth, financialyear,
productfamily, accountmanagerid, accountmanager,
countdownregion, avbuid, avregionid, currencycode_rc,
initial_rcCoS, initial_rc, annual_rcCoS, annual_rc,
rental_rcCoS, rental_rc, service_rcCoS, service_rc,
training_rcCoS, training_rc, gross_rc, cos_rc, net_rc, ytd_initial_rcCoS,
ytd_annual_rcCoS, ytd_rental_rcCoS, ytd_service_rcCoS, ytd_training_rcCoS,
ytd_initial_rc, ytd_annual_rc, ytd_rental_rc, ytd_service_rc, ytd_training_rc,
ytd_gross_rc, ytd_cos_rc, ytd_net_rc, opportunitytypename};
rowTotalRevenueByMonthRow.ItemArray = columnValuesArray;
this.Rows.Add(rowTotalRevenueByMonthRow);
return rowTotalRevenueByMonthRow;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public TotalRevenueByMonthRow AddTotalRevenueByMonthRow(
int totalcategory, string name,
int financialmonth,
int financialyear, System.Guid[] productfamily, System.Guid accountmanagerid,
string accountmanager, int countdownregion, System.Guid avbuid, System.Guid avregionid,
string currencycode_rc, double initial_rcCoS, double initial_rc,
double annual_rcCoS, double annual_rc,
double rental_rcCoS, double rental_rc,
double service_rcCoS, double service_rc,
double training_rcCoS,
double training_rc,
double cos_rc,
double ytd_initial_rcCoS,
double ytd_annual_rcCoS,
double ytd_rental_rcCoS,
double ytd_service_rcCoS,
double ytd_training_rcCoS,
double ytd_initial_rc,
double ytd_annual_rc,
double ytd_rental_rc,
double ytd_service_rc,
double ytd_training_rc, double ytd_cos_rc,
string opportunitytypename) {
TotalRevenueByMonthRow rowTotalRevenueByMonthRow = ((TotalRevenueByMonthRow)(this.NewRow()));
object[] columnValuesArray = new object[] {
totalcategory, name, financialmonth, financialyear, productfamily, accountmanagerid, accountmanager, countdownregion, avbuid, avregionid, currencycode_rc, initial_rcCoS, initial_rc, annual_rcCoS, annual_rc, rental_rcCoS, rental_rc, service_rcCoS, service_rc, training_rcCoS, training_rc, null, cos_rc, null, ytd_initial_rcCoS, ytd_annual_rcCoS, ytd_rental_rcCoS, ytd_service_rcCoS, ytd_training_rcCoS, ytd_initial_rc, ytd_annual_rc, ytd_rental_rc, ytd_service_rc, ytd_training_rc,null, ytd_cos_rc, null, opportunitytypename};
rowTotalRevenueByMonthRow.ItemArray = columnValuesArray;
this.Rows.Add(rowTotalRevenueByMonthRow);
return rowTotalRevenueByMonthRow;
}
Thank You.