SF BO throws DataAccessLayerException when Accessed any method of the BusinessObject.


SF BO throws DataAccessLayerException when Accessed any method of the...
Author
Message
StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
We'll you'll never learn unless you're shown or you ask questions.  So, keep asking the questions and we'll keep doing our best to answer them.  We don't know everything about .NET, but if we don't know it, we might have a better idea on what to type in your google search to find it and maybe point you in the right direction.
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Ben, thanks for all the feedback and support, I´m a newbie on .net and I think that Strataframe is the better way of go away from vfp and stay on the road of new technology close to .net.



Two days ago my boss buy the framework for me (I convinced him after four weeks of initial tests and learning) and I have thousand of questions, doubts (and a little of fear) but I happy with all of those because I sure that I choose the correct tool to make the fast as posible the application that he request to me with the great and awesome support that you bring to me and all the comunity on this forum Smile



I have to learn a lot about .net while learning the framework and I try to not disturb you and Trent so much in this path Smile



Thanks Again



- Fabian

[I learn I learn I learn]

StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I'm glad you got that working.  Smile

As for the calculated fields, we just implemented logic that allows you to use a calculated field with the AllowNullValuesOnNewRow = False (default) because the row tries to initialize the value and it cannot because it is readonly.  So, if you want to use a calculated field, and you get an error saying that you cannot update a readonly field in the InitializeRow() method, then let me know and I'll post the corrected DLLs for you.

Can I post a sample with a routine that recursively read a DB to fill a treeview on the contribution topic to read some feedback on what is wrong and what can I do in a better manner?

Sure thing Smile  We have the General .NET Discussion forum for just that sort of thing. (http://forum.strataframe.net/Forum14-1.aspx).  You can post anything in there and lots of people will be happy to help you out with it.

Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
3) Yes, the manual option allows you to retrieve the connection string any way you want to. You don't have to use the ConnectionManager class at all. (especially the ConnectionManager.SetConnections() method [Wink] ).



I especially not call this method as you say and all work ok (I was thinked that this line cannot have to be supressed Hehe )





4) Yes, the field must belong to the CurrentDataTable to be able to filter on it. So, if you add an additional column to the CurrentDataTable and populate that column, you'll be able to filter/sort on it. But, if you just have a custom field that does not have a backing column in the CurrentDataTable, you will not be able to sort/filter on it.



I don´t watched that I don´t need to use Currentview.table w00t

I called my "_ExtraColumnAdd" method after the fill method and voila! BigGrin





Private Sub _ExtraColumnAdd()



'Me.CurrentView.Table.Columns.Add("ExtraColumnName", System.Type.GetType("System.String"), "")

Me.CurrentDataTable.Columns.Add("ExtraColumnName", System.Type.GetType("System.String"), "")



Dim row As DataRow

'For Each row In Me.CurrentView.Table.Rows

For Each row In Me.CurrentDataTable.Rows

'Some stuff to fill the new column here

row("ExtraColumnName") = "Voila!"

Next row

End Sub





later on my form I can use this column like another



It´s the best thing to do about add a new calculated field that can be filtered?




Thanks Ben and Trent for all the support to learn all the stuff around Strataframe, you are awesome Smile








pd: Can I post a sample with a routine that recursively read a DB to fill a treeview on the contribution topic to read some feedback on what is wrong and what can I do in a better manner?



its used to create a tree menu like

1 : Module 1

1.1: ABMs

1.1.1: Customers

1.1.2: Employees / etc)

1.2: Configs


StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
1) A data source with a DataSourceKey of "" is not required, but recommended.  It's recommended because "" is the default DataSourceKey for business objects (and the DataSourceKey on the business object tells the business object which connection string to use).  So, you don't have ot use "", but if you don't you'll need to change all of the DataSourceKey properties to match throughout your application.

2) You figured this one out Smile

3) Yes, the manual option allows you to retrieve the connection string any way you want to.  You don't have to use the ConnectionManager class at all.  In fact, it's probably only recommended to use when have an internal application where your users will know their own connection string.  So, just change the SetDataSources() method to add the connections manually and acquire the connection string any way you like.  Then, just make sure you don't set any properties or call any methods on the ConnectionManager class (especially the ConnectionManager.SetConnections() method Wink).

4) Yes, the field must belong to the CurrentDataTable to be able to filter on it.  So, if you add an additional column to the CurrentDataTable and populate that column, you'll be able to filter/sort on it.  But, if you just have a custom field that does not have a backing column in the CurrentDataTable, you will not be able to sort/filter on it.

Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Forgive about the popup that appears when I run the project, I forgive when I debug the connections' stuff a 'ConnectionManager.ShowAvailableConnectionStrings()' [ question #2 ]



Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
about question #4 the post [url=http://forum.strataframe.net/Topic2952-9-1.aspx][/url] speak about create a extra column to internal data table, it´s ok or not apply? thanks



Post #2977

------------

Table 1 has InvtID

Table 1 has a calculated field (In the business object) that is a GUID that corrosponds to the Server/Database (ERPXrefKey). This is NOT a field in table 1, but is required for the correct entry in table2



Table 2 is in a different database

Key in Table2 is the ERPXrefKey and then InvtID



I'd like to form a business relationship with the calculated field and the key.



--------------------------------------------------------------------------

Post #2979

-----------

Ben Chase

Posted 09/22/2006 9:08:21 AM



Well, any time a business object needs to reference a field from the business object on the other side of the relationship, it uses the default property (indexer), which will return a value through any strong-typed property, not just the ones that are in the table. However, when the business objects attempt to do things such as cascading the row filter, or using the "FillByParent" methods, the business objects are expecting all of the fields to be part of the current data table and the table in the database. So, I'm not sure of a way around your problem other than to add an extra column to the internal data table of the business object each time the CurrentDataTableRefilled method fires and calculate the values for the extra column.



pd: attached a jpg with the popup that appears when I run the project (about question on previous post...)



Thanks again!



- Fabian
Attachments
errorsf.jpg (91 views, 43.00 KB)
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Hello, thanks for reply



I tested everything....except set 1 db with key '' and another with 'integra4config0 :/ it worked



#1 question: I have to set 1 datasourcekey with empty value (''), it is required? when I set 2 db, both with datasourcekey, the error appears, when I set 1 db with an empty datasourcekey and other with the datasourcekey it works Crazy



#2 another related question: when I change that, everytime I run the project, a screen appears to select the data connection, why this happen?



#3 question : If I set datasources manually (DataLayer.DataSources.Add(New SqlDataSourceItem("", "myconnectionstring")), can I avoid to display of any message of connectionmanager to the user of the compiled application? Can I override the connectionmanager and load a xml with my connectionstrings, read it and set datasource connections manually without any prompt?



#4 question [not related to datasources]

I created a custom field property (same as the tutorial) and try to filter with this field

MyBo1.filter = "MycustomField = 'something'"

I get a error like "the column [MyCustomField] cannot be found"

question: Can I filter via a custom field?



thanks for all the help Smile

StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The DataSourceKey that is the first parameter in the New SqlDataSourceItem should match the data source key that you set on your business objects. 

Try this and see if it works:

Comment out everything in the SetDataSources() method (don't use the ConnectionManager) and put this:

DataLayer.DataSources.Add(New SqlDataSourceItem("", "connection string to I4Net database"))
DataLayer.DataSources.Add(New SqlDataSourceItem("I4CONFIG", "connection string to integra4Config database"))

The first data source, I would leave with a DataSourceKey of an empty string because that is the default that the business objects use.  The second one, use a new key, like the "I4CONFIG" and set the DataSourceKey on the business objects that need to talk to it to that value.

Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
StakTrace:



en MicroFour.StrataFrame.Business.BusinessLayer.get__DataLayer()

en MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(DbCommand CommandToExecute)

en Integra4BOLibrary.MenuesBO.FillbyModulo(String Modulo) en C:et\Integra4BOLibrary\MenuesBO.vb:línea 87

en Integra4.Menu.SetearMenu() en C:et\integra4\Formularios\Menu.vb:línea 22

en Integra4.Menu.Menu_Load(Object sender, EventArgs e) en C:et\integra4\Formularios\Menu.vb:línea 14

en System.EventHandler.Invoke(Object sender, EventArgs e)

en System.Windows.Forms.Form.OnLoad(EventArgs e)

en MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)

en System.Windows.Forms.Form.OnCreateControl()

en System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

en System.Windows.Forms.Control.CreateControl()

en System.Windows.Forms.Control.WmShowWindow(Message& m)

en System.Windows.Forms.Control.WndProc(Message& m)

en System.Windows.Forms.ScrollableControl.WndProc(Message& m)

en System.Windows.Forms.ContainerControl.WndProc(Message& m)

en System.Windows.Forms.Form.WmShowWindow(Message& m)

en System.Windows.Forms.Form.WndProc(Message& m)

en System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)

en System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)

en System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search