Sunday, January 10, 2010

Problem with Crystal Report XI on Windows Vista

I've found an unresolved error recently, while trying to use Crystal Report XI on Windows Vista.

Error: While trying to create database connection on Crystal Report XI, a splash of dialog box which says "Please wait while windows configures Crystal Reports XI" appears. After a second, the dialog box disappears, and nothing happens. Seems like Windows fails to installs the DLL required by Crystal Report. I suppose there's something wrong with Windows Vista about managing the credential while installing Crystal Report, that some DLLs are not correctly registered.

I tried making the report using TTX on Windows XP, then open it on Windows Vista. Error dialog boxes are then displayed:








After searching the solutions on the internet for 2 days, I found a site which gives the following solution. It may work for the others, but it doesn't work for mine. Here's the post:

When running Office 2003 on Windows Vista, and trying to install an office update or do a repair installation, I received the following error:


Error 1904. Setup cannot register module C:\Windows\system32\FM20.DLL. If you click 'Cancel' or 'Ignore', run Setup again and re-install or repair your Office installation. If problem persists, contact your Information Technology department for assistance.


I found a possible solution online, to do the following:


At a command prompt using administrative credentials, run the following command:

REGSVR32 FM20.DLL


After running this command, I received the following error:


The module "FM20.DLL" was loaded but the call to DllRegisterServer failed with error code 0x8002801c

No matter what I tried, I could not get past this DLL registration error.

Here is what Microsoft sent me to fix this:


#1 Download the Subinacl.msi program from Microsoft's website. You can find it here.


#2 Copy the following text in a .bat file and run it with administrative credentials. It may take a while to finish. You will get a "Press any key to continue" message once it completes:


@echo off
subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f
subinacl /subdirectories %SystemDrive% /grant=administrators=f
subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=system=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=system=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=system=f
subinacl /subdirectories %SystemDrive% /grant=system=f

@Echo =========================
@Echo Finished.
@Echo =========================
@pause


#3 Try and register FM20.dll again, and it should succeed:

REGSVR32 FM20.DLL



If the solution above work for you, then it's fixed. If it doesn't, then you might be facing what I'm facing. If you find the solution to this problem, please do not hesitate to comment on this post. It will be really appreciated :)

Share:

Wednesday, December 23, 2009

Tester vs. Developer

Developer vs. Tester

This is just an intermezzo... lol :D

Share:

Monday, December 7, 2009

Error while trying to debug VB.NET desktop application

Error:
Error while trying to run project: Could not load file or assembly "AssemblyName" or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

This error appears as a dialog box while trying to debug an application.


Solution:
1. Check if the assembly name used for the project contains ' (apostrophe). If it does, go change it, and do not use ' (apostrophe)
2. Check if the name "Program" (without quotes) is used as the assembly name. If it is, go change the name.
3. If still, it does not work, right-click on the Project -> Properties -> Choose tab Debug -> Uncheck the option "Enable the Visual Studio Hosting Process"


Share:

Tuesday, November 10, 2009

Ado command object returns method 'Execute' of object '_Connection' failed

Error: method 'Execute' of object '_Connection' failed


Solution: Check the query used while executing the recordset, it may contain keyword used in the database. In my case, my query is:




select languageid, language from masterlanguage order by languageid


The error occurs because I use a keyword in the query, i.d. language.
To fix the error, either change the column name on the database, or use []:


select languageid, [language] from masterlanguage order by languageid



Share:

Friday, November 6, 2009

Disabling web.config inheritance for child application

Error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'Control' or one of its dependencies. The system cannot find the file specified. (d:\Web\VS\Website\web.config line 82)

Source Error:

Line 77: <httphandlers>
Line 78: <remove path="*.asmx" verb="*">
Line 79: <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false">
Line 80: <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false">
Line 81: <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false">
Line 82: <add path="SecurityImageHandler.ashx" verb="*" type="Control.SecurityImageControlHandler, Control">
Line 83: </httphandlers>



Solution:
I have an application which has a child (sub folder) application in it. In my case, I added a tag in the parent application:

<add path="SecurityImageHandler.ashx" verb="*" type="Control.SecurityImageControlHandler, Control">



When deployed, an error occurs in the child application, since the assembly added in the parent application is also recognized by the child application. To avoid the child application from reading the tag added on the parent application, we have to remove the tag on the web.config of the child application.

After adding the code to remove the tag, it will look like this:

<httpHandlers>
...........
...........
<remove verb="*" path="SecurityImageHandler.ashx"/>
...........
...........


Share:

Pinky award :D

Another award from a sweet friend, Ria Adria ^^



Share:

Wednesday, November 4, 2009

Error uploading file in ASP.NET

Error:
XML Parsing Error: no element found
Location: http://10.21.9.12/Web/UploadFile.aspx
Line Number 1, Column 1:
^

This error occurs because the size of the file uploaded is too big and not handled in the web.config.

Solution: add this tag to the web.config in the <system.web></system.web> section:

<system.web>
<httpRuntime maxRequestLength="2048000">
</system.web>



There's a limitation used in the maxRequestLength. 2048000 is the value I use in VS 2008. If I'm not mistaken, in VS 2003, the maxRequestLength is 1024000. Note that this value is in KB (Kilo Byte).
Share:

Sunday, November 1, 2009

Another blog award ^^

Have just got a lovely blog award, my second one, from a friend, Mona ^^



But there is a rule to accept this award.. hehehe... Post it on your blog together with the name of the person who has granted the award, and his or her blog link. Pass the award to 15 other blogs that you’ve newly discovered. Remember to contact the bloggers to let them know they have been chosen for this award.

I don't have too many blogging friends, so I'll just give it to...

Share:

Wednesday, October 14, 2009

Creating Sub Report using TTX in VB

Before creating sub report using TTX in VB, you should have already known how to create report using TTX. Otherwise, you may want to find out how to create report using TTX in my previous post.

Before going to the sub report, it's a good idea to share the code query in Visual Basic used to retrieve the data first.



Private Sub cmdPrint_Click()
Dim rs As New ADODB.Recordset 'recordset for main report
Dim rs1 As New ADODB.Recordset 'recordset for subreport
Dim sql As String
With CrystalReport1
.Reset
'Set data for main report
sql = "select CustomerID, CompanyName, ContactName, ContactTitle, " & _
"Address from Customers where Country = '" & cmbCountry.Text & "'"
Set rs = New ADODB.Recordset
Set rs = con.Execute(sql)

.ReportFileName = App.Path & "/RptTest.rpt"
.Destination = crptToWindow
.SetTablePrivateData 0, 3, rs
'End set data for main report

'Set data for subreport
.SubreportToChange = .GetNthSubreportName(0)
sql = "select a.customerid, d.productname, c.quantity, c.unitprice " & _
"from customers a " & _
"left join orders b " & _
"on b.customerid = a.customerid " & _
"left join orderdetails c " & _
"on c.orderid = b.orderid " & _
"left join products d " & _
"on d.productid = c.productid " & _
"order by a.customerid, d.productname"
Set rs1 = New ADODB.Recordset
Set rs1 = con.Execute(sql)
.SetTablePrivateData 0, 3, rs1
'End set data for subreport

.WindowState = crptMaximized
.WindowShowPrintBtn = True

.Action = 1
End With
End Sub

Suppose here's the data retrieved in the main report:


And here's the data retrieved in the sub report:


In this case, we would retrieve the data on the main report, while at the same time, show the orders made by each customer.

Note that there has to be one or more linking fields between the report and sub report in this case. In the data shown above, the linker is the field CustomerId.

Steps in creating the sub report:
1. Assume the main report is done, like the following picture (if you have not tried making the main report, you may want to refer to my previous post about making the main report):



2. To insert sub report, choose menu Insert -> Subreport, then a dialog box will be prompted, insert the desired sub report name, then click Report Expert.



3. Another dialog boxes will be prompted, we will have to create new TTX for the sub report. The steps are the same as those used in creating the TTX for the main report.


4. After finished creating the TTX, add the TTX to the report.


5. Then, go to tab Fields, Add the fields to be displayed on the report, then click OK.


6. And here's the report with the sub report embedded in it.


7. To Edit the view of sub report, double click on the report, and arrange it to get desired layout.


8. After done with the layout of the sub report, we have to go back to the main report to link the report and the sub report to get desired data grouped by certain field(s). In the data used above, the linker field is CustomerId. Right-click on the sub report, choose Change Subreport Links. As we're going to link the field CustomerId in the main report and the subreport, choose the field on the main report, then select the linking field in the sub report (Make sure the field linked on the lower right is the field which belongs to the sub report, not the main report). Click OK.


9. Now we're finished with the main and sub report.

After running the program, we will get a report which contains the data of the Customers and the order details of each customer as the picture shown below.



That's all folks... Good Luck ^^
Share:

Friday, October 2, 2009

Playing with Query - Grouping

Query Language : SQL

Simply saying, here are the tables:
table users (userid, name)
table book (bookid, bookname, author)
table review (reviewId, UserId, BookId, Comment, ReviewDate)

Question: Find users who have reviewed 2 different books on the same day!

Query for creating tables:
create table users (userid int , [name] varchar(50))
create table book (bookid int, bookname varchar(50), author varchar(50))
create table review (reviewId int , UserId int, BookId int, Comment varchar(50), ReviewDate datetime)



Query for data sample:
insert into users values (1, 'A')
insert into users values (2, 'B')
insert into users values (3, 'C')

insert into book values (1, 'Book A', 'Author A')
insert into book values (2, 'Book B', 'Author B')
insert into book values (3, 'Book C', 'Author C')

insert into review values (1, 1, 1, 'AAAA', getdate()-5)
insert into review values (2, 1, 2, 'AAAA', getdate()-5)
insert into review values (3, 1, 3, 'AAAA', getdate()-5)
insert into review values (4, 2, 1, 'AAAA', getdate()-4)
insert into review values (5, 2, 2, 'AAAA', getdate()-4)
insert into review values (6, 2, 1, 'AAAA', getdate())
insert into review values (7, 3, 2, 'AAAA', getdate())
insert into review values (8, 3, 1, 'AAAA', getdate())



By using the query below:
select a.userid, a.userid, b.name, a.bookid, c.bookname, a.reviewdate
from review a
left join users b on b.userid = a.userid
left join book c on c.bookid = a.bookid



The resulting records will be:


Answer:
select * from
(
   select userid, bookSum = count(userid), reviewDate = convert(char(10), reviewdate, 105)
   from review
   group by userid, convert(char(10), reviewdate, 105)
) a
where bookSum = 2


or

select userid, bookSum = count(bookid), reviewDate
from review
group by userid, convert(char(10), reviewdate, 105)
having count(bookid) = 2

And the resulting records will be:



PS: Convert to type 105 is only aimed to convert the type of the date to dd-MM-yyyy so that the date to be compared does not include the time.
Share:

Wednesday, September 30, 2009

Fail creating virtual directory

Error: Creation of the virtual directory http://localhost/web failed with error: Could not find the server 'http://localhost' on the local machine. Creating a virtual directory is only supported on the local IIS server.

This error appear as a dialog box when trying to load a project whose virtual directory had been created formerly.

Actually, there are two dialog box:
1. The first dialog box sounds: The local IIS URL http://localhost for Web project web has not been configured. In order to open this project the directory needs to be configured. Would you like to create the virtual directory now?

2. After clicking yes, the second dialog box appears: Creation of the virtual directory http://localhost/web failed with error: Could not find the server 'http://localhost' on the local machine. Creating a virtual directory is only supported on the local IIS server.


Solution:
The solutions may vary in this case. Here are some possible solutions:
1. Make sure the asp.net is already registered to the IIS. You may want to try registering it to IIS

2. The virtual directory of the project might not have been set properly, so it can not be loaded. Edit the virtual directory of the project by right-clicking the project, choose Edit project (.csproj) file, then at the bottom part of the file, you may find something like <iisurl>http://localhost/</iisurl>
Change / add the name of the web project, e.g. <iisurl>http://localhost/webname</iisurl>

3. Make sure the IIS is running well on services.msc. To check it, press windows + Run, type "Services.msc" (without quotes), then restart IIS Admin.



Afterwards, restart the IIS by pressing windows + Run, type "inetmgr" (without quotes), then start the service.



4. This is a rare case, but someones might encounter it too. If you are using another web server on your computer, e.g. Apache, xampp, etc., make sure you stop the web server first, then start the IIS. In a case I met, it still didn't work, after about half an hour trying to find the problem, I found the issue. Someone changed the port used for the web server. So, I had to change it again.
On the IIS window, right click on the Default Web Site, choose Properties, then make sure the port used is 80 (I'm not sure if using another port is ok here).

Share:

You may be intersted in

Related Posts

Updating Table Containing Xml Column via LinkedServer

If you are trying to update a table containing XML column via Linked Server in SQL Server, and you are not able to, you are not alone. There...

About Me

My photo
Is an ordinary man, with a little knowledge to share and high dreams to achieve. I'd be glad if I can help others, 'coz the only thing for the triumph of evil is for a good man to do nothing.

About Blog

You can find a lot of debugging and deploying problems while developing applications in .NET and Visual Basic here. There are also some querying tips in SQL and typical source codes which might be useful shared here.

Popular Posts

Blogroll

Followers

Leave a Message