ComboBoxEdit Requery Event Failing


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Time to get some help on this.

I have a comboboxedit control that has a requery event taking three integer parameters.  The FillDataTable method in the BO looks like this:

public void FillByOrderIndex(int pPLType, int pMasterIndex, int pAddrIndex)
{
   
SqlParameter mPLType = new SqlParameter("@pltype", pPLType);
   
SqlParameter mMasterIndex = new SqlParameter("@masterindex", pMasterIndex);
   
SqlParameter mAddrIndex = new SqlParameter("@addrindex", pAddrIndex);
    FillByStoredProcedure(
"spx_GetOrderItemList", mPLType, mMasterIndex, mAddrIndex);
}

This actually works (thanks for the help earlier this week!).  The problem comes in when the combobox hits one of the resulting columns.  It is the "orderid" field.  It gets to the following code:

[
Browsable(false),
BusinessFieldDisplayInEditor(),
Description(""),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public System.Int32 orderid
{
   
get
   
{
       
return (System.Int32)this.CurrentRow["orderid"];  <--*** OFFENDING CODE ***
    }
   
set
   
{
       
this.CurrentRow["orderid"] = value;
    }
}

The get_orderid() method kicks out a "Specified cast is not valid" error.  If I place the parameters into the SQL Query Analyzer, I get a result set that does have an orderid and it is an integer value.

Any ideas about what I should do or where to look for a solution?

Thanks!!
Bill



Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Now, it works.  This is a SQL Server 2000 application.  Could anyone provide a reason for this kind of behavior?

I would have to set this up on an SQL Server 2000 machine...but it was actually SQL Server passing it over as long...not the BO converting the value.  It has been a while since I lived in SQL Server 2000 as we only use 2005 (and soon 2008) any more in the field.  However, if I am not mistaken, I think that when a field was derived in SQL Server 2000 and it was not explicity defined in a variable or from an underlying field table, it always went the the larger of the values...in this case LONG (BIGINT) over INT.  I would have to get my head back into the older rules...but at any rate, I am glad you got it figured out.

Now you have my curiosity up...I will have to load a 2000 machine up and give it a go BigGrin

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Thanks for the response.  I long to be on SQL Server 2008.  Our adoption of newer versions is a bit slow.  I did get authorization to obtain SS2008 for installation and migration later this summer.  I expect to be blown away by the improvements.  But, I also expect a good chunk of work getting all of the databases relocated.  It will be fun work, though!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Bill Cunnien - 17 Years Ago
Greg McGuffey - 17 Years Ago
Bill Cunnien - 17 Years Ago
Bill Cunnien - 17 Years Ago
Greg McGuffey - 17 Years Ago
                         Still broken. I am still trying tochange one thing at a time to...
Bill Cunnien - 17 Years Ago
                             Here is the error report: InvalidCastException Specified cast is not...
Bill Cunnien - 17 Years Ago
                                 Did you set the FieldPropertyDescriptor for this property?
Greg McGuffey - 17 Years Ago
                                     Not exactly sure what you are talking about...sorry. After you...
Bill Cunnien - 17 Years Ago
                                         Take a look at this post, you've got the property setup, just...
Greg McGuffey - 17 Years Ago
                                             I am defining the table in DDT, creating a BO, then pointing the BO to...
Bill Cunnien - 17 Years Ago
                                                 The BO isn't even completed with the data retrieval method and I get...
Bill Cunnien - 17 Years Ago
                                                     Added a watch to the variable loValue (which looked like it had a...
Bill Cunnien - 17 Years Ago
                                                         The table in SQL Server has the orderid field defined as INT. That...
Bill Cunnien - 17 Years Ago
                                                             [quote]Now, it works. This is a SQL Server 2000 application. Could...
Trent L. Taylor - 17 Years Ago
                                                                 Thanks for the response. I long to be on SQL Server 2008. Our adoption...
Bill Cunnien - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search