If you receive this error then you have probably mixed up some data types between your class (class.cs) file and your mapping (class.hbm.xlm) file. For example you have a property defined in your class file as a string and then in your mapping file as an int. To repair the PropertyAccessException Invalid Cast (check your […]
Read More →Author: Benjamin Perkins
Displaying detailed error messages in IIS
One of the first questions I ask when troubleshooting an IIS case is “What HTTP Status code are you receiving?” I ask this question because it sets the direction for further analysis. In this example I want to discuss the 404 status code and how you might need to make some changes or do some […]
Read More →Custom Error Pages – HTTP Error 500.19 – Internal Server Error
Rendering custom error pages can be helpful when, for example, the custom error page provides some information on how to resolve the error. Perhaps if a client attempts to access a file which does not exist on the web site, meaning they receive a 404 HTTP status code, you can render a page which has […]
Read More →NHibernate error, incorrect syntax near the keyword
Common sense, maybe…, worthy of a blog, absolutely. I was creating an ordering system using NHibernate and the table which stored the orders was called ORDER. This resulted in an error, which I believe would come from any data retrieval source, I just happen to be using NHibernate with SQL Server and Oracle. The error […]
Read More →Updating Child records with NHibernate using HQL-IQuery and C#
I tend to overcomplicate things, I think that I do it subconsciously in an attempt to make sure I give due diligence in the search for the best solution. I had a parent child relationship mapped out using NHibernate. Something like the below where there is a one-to-many bag in the parent class and a […]
Read More →Invalid Index N For This SqlParameterCollection using NHibernate
While trying to insert parent child composite key linked into a database I received this error: Ungültiger Index N für SqlParameterCollection mit Count=8 Invalid Index N For This SqlParameterCollection with count=8 When I added the: insert=”false” attribute to the 8th property in my mapping file, the issue was resolved. Start with the ID at 0 […]
Read More →Inserting Parent Child records using NHibernate IDENTITY INSERT OFF
One of the errors I received when I was trying to get the parent child insert to work with NHibernate was: Ein expliziter Wert für die Identitätsspalte kann nicht in der ‘CHILD’-Tabelle eingefügt werden, wenn IDENTITY_INSERT auf OFF festgelegt ist Cannot insert explicit value for identity column in table ‘IdentityTable’ when IDENTITY_INSERT is set to […]
Read More →How to hide a DataGrid column in WPF using C#
In a situation where I have a DataGrid which is being bound to a List of a specific class and the DataGrid has AutoGenerateColumns set to true, I found myself needing a way to hide some of the columns which I did not want to present to a user. Below is an example of binding […]
Read More →How to capture double click event in Data Grid row using WPF and C#
There are a number of name differences between a windows form and a WPF program. For example, in a windows form program the event which is triggered when a user double-clicks on a data grid is called Doubleclick. The event in a WPF program is called MouseDoubleClick. Therefore the way to implement, program or add […]
Read More →Get column value from DataGrid, NewItemPlaceholder, WPF, DataRowView and exception using C#
The way a problem is approached can have some serious consequences. Take for example the task I had to add some data to a DataGrid in WPF and allow a user to select the rows. When the rows were selected I would capture the details and put them into a form where they could be […]
Read More →