Home All Groups Group Topic Archive Search About
Author
21 Nov 2007 3:44 PM
JimHeavey
Using the UI to create a dataset and then the associated queries...one of the
queries I created the following SQL statement....

SELECT  ACCT_NUM, EMPLOYEE_ID, NAME, ADDR_LINE1, ADDR_LINE2, CITY, STATE,
ZIP,
              BUS_PHONE, HOME_PHONE, OLD_ACCT_NUM, GE_RATING, CST_CTR,
COM_NUM,
              BUS_UNIT, EXP_DATE, CRDT_LMT_AMT, SINGLE_PURCH_LIMIT,
TBR_CODE, RECONN,
              PURGED_ACCT, CASH_LMT_AMT, REG_ID, NAT_ACCT, FUN_ACCT,
GE_STATUS, GE_REASON
FROM  PROC_GE_DATA
WHERE (:ACCT_NUM is null OR ACCT_NUM LIKE :ACCT_NUM)
     AND :EMPLOYEE_ID is null OR (EMPLOYEE_ID LIKE :EMPLOYEE_ID)
     AND (:NAME is null OR NAME LIKE :NAME)
     AND (:CST_CTR is null OR CST_CTR LIKE :CST_CTR)
     AND (:BUS_UNIT is null OR  BUS_UNIT LIKE :BUS_UNIT)
     AND (:FUN_ACCT is null OR FUN_ACCT LIKE :FUN_ACCT)
     AND (REG_ID = :REG_ID)
     AND (NAT_ACCT = :NAT_ACCT)

When I look at the Generated method for this query, all is right with the
world...It generates the following:

        [System.Diagnostics.DebuggerNonUserCodeAttribute()]

[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
        public virtual GE.PROC_GE_DATADataTable
GetProc_Ge_DataByDynamicCriteria(string ACCT_NUM, string EMPLOYEE_ID, string
NAME, string CST_CTR, string BUS_UNIT, string FUN_ACCT,
System.Nullable<decimal> REG_ID, System.Nullable<decimal> NAT_ACCT) {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            if ((ACCT_NUM == null)) {
                throw new System.ArgumentNullException("ACCT_NUM");
            }
            else {
                this.Adapter.SelectCommand.Parameters[0].Value =
((string)(ACCT_NUM));
            }
            if ((EMPLOYEE_ID == null)) {
                throw new System.ArgumentNullException("EMPLOYEE_ID");
            }
            else {
                this.Adapter.SelectCommand.Parameters[1].Value =
((string)(EMPLOYEE_ID));
            }
            if ((NAME == null)) {
                this.Adapter.SelectCommand.Parameters[2].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[2].Value =
((string)(NAME));
            }
            if ((CST_CTR == null)) {
                this.Adapter.SelectCommand.Parameters[3].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[3].Value =
((string)(CST_CTR));
            }
            if ((BUS_UNIT == null)) {
                this.Adapter.SelectCommand.Parameters[4].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[4].Value =
((string)(BUS_UNIT));
            }
            if ((FUN_ACCT == null)) {
                this.Adapter.SelectCommand.Parameters[5].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[5].Value =
((string)(FUN_ACCT));
            }
            if ((REG_ID.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[6].Value =
((decimal)(REG_ID.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[6].Value =
System.DBNull.Value;
            }
            if ((NAT_ACCT.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[7].Value =
((decimal)(NAT_ACCT.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[7].Value =
System.DBNull.Value;
            }
            GE.PROC_GE_DATADataTable dataTable = new
GE.PROC_GE_DATADataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }


Now if I go in an modify this SQL statemenet and adjust the last 2
parameters and make them look like the following:

     AND (:REG_ID is null OR REG_ID = :REG_ID)
     AND (:NAT_ACCT is null OR NAT_ACCT = :NAT_ACCT)

Then when I recompile, the class is generated incorrectly.  Both of these
fields are defined as Decimal?, but when I make the above change, the code
identifies the "REG_ID" to be string....

        public virtual GE.PROC_GE_DATADataTable
GetProc_Ge_DataByDynamicCriteria(string ACCT_NUM, string EMPLOYEE_ID, string
NAME, string CST_CTR, string BUS_UNIT, string FUN_ACCT, string REG_ID,
System.Nullable<decimal> NAT_ACCT) {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            if ((ACCT_NUM == null)) {
                throw new System.ArgumentNullException("ACCT_NUM");
            }
            else {
                this.Adapter.SelectCommand.Parameters[0].Value =
((string)(ACCT_NUM));
            }
            if ((EMPLOYEE_ID == null)) {
                throw new System.ArgumentNullException("EMPLOYEE_ID");
            }
            else {
                this.Adapter.SelectCommand.Parameters[1].Value =
((string)(EMPLOYEE_ID));
            }
            if ((NAME == null)) {
                this.Adapter.SelectCommand.Parameters[2].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[2].Value =
((string)(NAME));
            }
            if ((CST_CTR == null)) {
                this.Adapter.SelectCommand.Parameters[3].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[3].Value =
((string)(CST_CTR));
            }
            if ((BUS_UNIT == null)) {
                this.Adapter.SelectCommand.Parameters[4].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[4].Value =
((string)(BUS_UNIT));
            }
            if ((FUN_ACCT == null)) {
                this.Adapter.SelectCommand.Parameters[5].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[5].Value =
((string)(FUN_ACCT));
            }
            if ((REG_ID == null)) {
                this.Adapter.SelectCommand.Parameters[6].Value =
System.DBNull.Value;
            }
            else {
                this.Adapter.SelectCommand.Parameters[6].Value =
((string)(REG_ID));
            }
            if ((NAT_ACCT.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[7].Value =
((decimal)(NAT_ACCT.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[7].Value =
System.DBNull.Value;
            }
            GE.PROC_GE_DATADataTable dataTable = new
GE.PROC_GE_DATADataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }
I am working with an Oracle Table....

Is there a work around for this?

Thanks in advance for your assistance

AddThis Social Bookmark Button