Invalid Argument Exception


Author
Message
PeterA
PeterA
StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)
Group: Forum Members
Posts: 72, Visits: 235
I'm getting a strange error when I attempt to fill a business object from a DB2 database. I know I must be missing something simple (having just now figured out what I was doing wrong with not being able to even try filling a business object), but I'm just not seeing what the problem is.



First, here's the stack trace:





IBM.Data.DB2.DB2ConnPool.a(String A_0, a& A_1, c& A_2) +11132

IBM.Data.DB2.DB2Connection.set_ConnectionString(String value) +353

MicroFour.StrataFrame.Data.Db2.Db2DataSourceItem.CreateBlankDbConnection() +62

MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack) +73

MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(QueryInformation QueryInfo, OnChangeEventHandler CallBack) +56

MicroFour.StrataFrame.Data.DataLayer.GetDataTable(QueryInformation QueryInfo, Boolean RegisterNotification) +154

MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(QueryInformation QueryInfo) +54

Payless.Sourcing.MaterialsManagement.SuppliersListing.Page_Load(Object sender, EventArgs e) in I:\PSS Design\Visual Studio\Materials Management\MM_UI\Suppliers\listing.aspx.cs:54

System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15

System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34

System.Web.UI.Control.OnLoad(EventArgs e) +99

System.Web.UI.Control.LoadRecursive() +47

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061





What I'm doing is creating a connection which is added to the DataLayer (i.e. mySqlh). I then build a QueryInformation object to get that would fill the business object (i.e. qBizQuery), set the business object's DataSourceKey to the same as the DataSourceKey I just created (from a Web.Config file) and then attempt to fill the business object.





DataLayer.DataSources.Add(new Db2DataSourceItem(Global.Config['DataSourceKey"], connectionString, IBM.Data.DB2.DB2Factory.Instance);



mySqlh = DataLayer.DataSources[Global.Config['DataSourceKey']];



qBizQuery = new QueryInformation();



BizObject.DataSourceKey = Global.Config["DataSourceKey"];

BizObject.FillDataTable(qBizQuery);





The mySqlh object is actually used further down in my code to build a dataset for a gridview control.



So, finally to my question: am I attempting to implement the business objects correctly? Am I missing something else that is causing this invalid argument?



Thanks!
Replies
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I'm not sure.  This is the code from the Db2DataSourceItem for CreateBlankDbCommand():

Public Overrides Function CreateBlankDbConnection() As System.Data.Common.DbConnection
    Dim conn As DbConnection = Me._Factory.CreateConnection()
    conn.ConnectionString = Me.ConnectionString
    Return conn
End Function

All it does is create the connection and set the connection string.  The exception is being thrown by the middle line that is attempting to set the connection string.  So, the only thing I can think of that might throw an argument exception would be the connection string itself.  But, as you said, you're using it to retrieve data elsewhere.  So...

What you might try is replicating this code right here.  Use the same factory that you passed when you created the Db2DataSourceItem and create a connection and then try to set the connection string to the DataLayer.DataSources[""].ConnectionString and see if it throws an error.

PeterA
PeterA
StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)
Group: Forum Members
Posts: 72, Visits: 235
I did manage to track this down on Friday, but didn't get a chance to post what fixed it. What was happening was it picked up the new line character in the file it was reading for a password. Once I made sure it stripped that out, it worked fine.



Thanks!

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Excellent.  I'm glad you got it working because I was stumped Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
PeterA - 18 Years Ago
StrataFrame Team - 18 Years Ago
PeterA - 18 Years Ago
StrataFrame Team - 18 Years Ago
PeterA - 18 Years Ago
                         I'm not sure. This is the code from the Db2DataSourceItem for...
StrataFrame Team - 18 Years Ago
                             I did manage to track this down on Friday, but didn't get a chance to...
PeterA - 18 Years Ago
                                 Excellent. I'm glad you got it working because I was stumped :)
StrataFrame Team - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search