Wednesday, October 28, 2009

Another issue in DevExpress XtraReports EUD

Another issue in the DevExpress XtraReports End-User Designer. After the user creates a report, when trying to open it they receive the following exception error:

Member names cannot be the same as their enclosing type

This is likely to have been caused by the creation of a new data source with the same name as the table to which it is connecting.

Wednesday, October 21, 2009

Invoke or BeginInvoke cannot be called

Using the DevExpress XtraReport Designer, if you encounter the following exception error on closing:

Invoke or BeginInvoke cannot be called on a control until the window handle has been created.

The most likely cause is a failure to close an open report on an XRDesignPanel (XrDesignPanel.CloseReport()).

Cannot implicitly convert type 'string'

Using the DevExpress XtraReport object: When saving a report layout (using me.SaveLayout()), and then re-loading it (me.LoadLayout()), you receive an exception (XRSerializationException) similar to the following:

Cannot implicitly convert type 'string' to 'DevExpress.XtraReports.UI.XRTableCell'

A known cause of this is when one of the controls/objects in the report has an 'invalid' name. e.g. using a label called 'name' will trigger this exception when trying to reload the report when it encounters a line such as 'me.Name = 'myreport'. It will confuse the report name attribute with the control called 'name'.

Tuesday, October 14, 2008

Commitment Control in ad-hoc SQL queries

Commitment control can be implemented using TRANSACTION statements. An example is shown below.

BEGIN TRANSACTION

UPDATE tblUser SET sName=sName+’@’ WHERE sName like ‘F%’

IF @@ERROR<>0
BEGIN
   ROLLBACK TRANSACTION
END
ELSE
BEGIN
   COMMIT TRANSACTION
END
GO

When using query analyser, commitment control can be applied across a series of individually run SQL statements, see the example below.

BEGIN TRANSACTION

USE pubs
GO

UPDATE titles
SET advance = advance * 1.25
WHERE ytd_sales > 8000
GO

COMMIT TRANSACTION
GO

Note: the BEGIN TRANSACTION statement will lock resource until either a COMMIT or ROLLBACK statement is executed.

Monday, October 13, 2008

Issue with the .Net CF WebBrowser object

Using the WebBrowser object in a .Net Compact Framework Pocket PC application, all appeared to work by design, except for in a specific area of the code.

Here, when reloading the page after populating WebBrowser.DocumentText, the page would sometime display corrupted (as if the same HTML had been added part way through the HTML code). Under debug I could see the HTML code, which was correct, though (stepping through the code) when the web page was displayed in the WebBrowser object it was corrupted.

In addition to this issue, occassionally the whole application would crash out (even when in a try catch statement). If I turned on Error Reporting in Windows Mobile 6.0, at this point it would display an exception within WEBVIEW.DLL.

I found that converting the WebBrowser.DocumentText to WebBrowser.Navigate(), and creating a temporary HTML file containing the 'offending' HTML code, worked.

original code:
wb.DocumentText = sHTMLString

new code:
Dim TmpFile As String = "\My Documents\Temp.htm"
Dim oSR As IO.StreamWriter
If IO.File.Exists(TmpFile) = True Then IO.File.Delete(TmpFile)
oSR = IO.File.CreateText(TmpFile)

oSR.WriteLine(sHTMLString)
oSR.Dispose()
oSR = Nothing
wb.Navigate(New Uri("
file:///my documents/Temp.htm"))

To try to standardise the code throughout my application I began converting all instances of WebBrowser.DocumentText to WebBrowser.Navigate() (as above), but everywhere else I used it, the page would first display as blank. When I then held the stylus down and selected REFRESH, this then loaded the page correctly. Note: Trying to refresh the page programmatically using WebBrowser.Refresh() didn't work.

So, the work around for me was to use WebBrowser.DocumentText everywhere except where it failed, and there use WebBrowser.Navigate().

Thursday, October 2, 2008

SQL Server - running out of free space

If the SQL Server appears to be running out of free disk space, check the size of both the log and data physical files.

If any appear larger than they probably should be, check the Recovery Model of the database. You can do this through SQL Enterprise manager.

Recovery Model = FULL
The Recovery Model should only be set to FULL if the transactional log is regularly being backed up (throughout the day), followed by a database back up at night - otherwise the log will grow too quickly and swallow up the free disk space.

Recovery Model = SIMPLE
If you are not regularly backing up the transactional log, the Recovery Model should be set to SIMPLE.

Issue with DCom Security Settings...

Changes to the DCom security settings cause various functions to fail.

Symptoms:

* Unable to send mail via Outlook
* Drag and Drop not allowed
* Specific software installations fail (e.g. Microsoft SQL Server 2005)

RESOLUTION
To resolve this behavior, perform the following steps:

1. Click Start, click Run, type dcomcnfg, and then click OK.
2. Click the Default Security tab.
3. In the Default Access Permissions box, click Edit Default.
4. Verify that both System and Interactive are listed with Allow Access. If either are missing, add them by clicking Add.
5. In the List Names From box, make sure that the local computer name is listed.
6. Set Type of Access to Allow Access.
7. Click the account that is missing, and then click Add.
8. Repeat Step 7 if both accounts are missing.
9. Click OK, click OK, and then click OK again.

To update your settings, you must log off, and then log on to the computer.

see Microsoft KB article http://support.microsoft.com/?id=274696