Inappropriate comments will be deleted at my discretion.
The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.
Marc, you're right ofcourse that comments like "The data table" are not useful. As I said, you need to add a bit more information to the stuff generated. And as you said, it's great when it is able to get "derived" documentation. It's equally great when documenting properties, at least I think so.
I'm sorry to say, but you're comment "If code comments are not reviewed on their contents, than GhostDoc is the tool for you!" sounds a bit disappinting. Yes, code comments could benefit from reviews. But that goes for comments created using the help from GhostDoc as for the stuff added by more or less "intelligent" developers.
It's still up to the developer to write something useful. GhostDoc is a tool to help you create documentation and create the obvious stuff.
As I mentioned before , I will be attending the Microsoft European TechEd in Barcelona from November
Hmm, well I checked vid.nl and traphic.nl and both gave me identical information. So I guess it's ok ;-)
Please keep the unhappy few left here in the Netherlands informed.
Have fun over there!
Jan wrote that he sees possibilities in Windows Presentation Foundation, for one that he doesn't need
I'm very happy with the short posts. It shows an overview of what happens there and it kind of feels like I'm also in Barcelona.
Of course the more detail the better, but that is hard with like 8 sessions a day.
Report Builder is available since the beginning of SQL Server Reporting Services 2005. Before it was also available as an add-on to SQL Server Reporting Services 2000 delivered by a company called ActiveViews. try http://www.activeviews.com and you will be suprised where you end up. Not ;-).
New to SP2 is Oracle Support in Report Builder. Users will now be able to use Report Builder on top of Oracle data sources.
Two things
- C# requires case senstivity, so streamwriter won't work.
- If you haven't referenced the assembly, it can't find the namespace. Obviously, but it does suck! ;)
I know C# is case sensitive, but trust me, the key-combination Alt+Shift+F12 does actually find the namespace if you type streamwriter instead of StreamWriter. The new option in VS 2005 is case-sensitive. And yeah, you do need the assembly... I updated the post!
Hello Jan,
Opening a new tab is considered equivalent to opening a new Window (Ctrl+N) in the same IE client application. You can verify this behaviour in IE6.
Apparently, the original - and newly opened window or tab share cookies.
Was this what you meant?
Keep up the good writing ;)
Regards,
David van Leerdam
This is the same with IE6 as long as you don't fork a new IE proces but open up new windows with CTRL+N.
And Firefox also has this same behaviour. If you don't want this behaviour then just launch a new instance.
Ecco arrivati all'ultimo atto di
Jan,
Weird. The full name with the 'Attribute' postfix is the .NET Framework class name of the attribute, but as far as I know the 'Attribute' postfix is not required when using the attribute as an attribute (for readability, the compiler expands the attribute name when the attribute is applied on the class).
See also:
http://www.ondotnet.com/pub/a/dotnet/excerpt/vbnut_8/index1.html
In other words, both are syntactically correct and - should be equal in result. I wonder if this is reproducable and whether it is a bug or not.
Keep up the good writing.
Dennis van der Stelt with a step-by-step guide on how to disable email notifications of Spam , linking
Jan Schreuder on changing the settings in CopySourceAsHtml for best use with Community Server.
Exactly one month ago, I blogged about XML Notepad 2007 . XML Notepad 2007 is the replacement for the
I think the combo to do this without selecting the text is Ctrl-K Ctrl-D
Just out of curiosity, do you think this has anything to do with the Time Zone update (http://support.microsoft.com/kb/928388) earlier this year? My company switched to TFS before the time zone changes went into effect, but I've never run into that problem in the 14+ months I had been using VSS 2005.
You would think it wouldn't be a problem, but you never know.
I really wouldn't know. It did annoy me though.
PingBack from http://idstam.com/wp/2007/05/02/hantera-flera-assemblyinfocs-i-visual-studio/
Author : Jan Schreuder After years of experience as a developer in multiple languages, Jan shares his vision on software development with the world.
How to hide the Main Reprot Display? I just want to display the report page nothing else.
Use the ViewerTabs method and set the Visible argument to false
Thanks, great code
Hi Jan, i need your CrystlaHelper to use it into my application but the link to the zip file dont work.
Thankz
Hi, I have a report that has one OUT parameter, and one IN-OUT Parameter. It links to an Oracle Stored Procedure. My default value for the parameter was 5.
Im calling the report from a C# Windows application, and letting it export to a PDF file.
My report runs fine and exports perfectly using the default parameter.
But as soon as i set the parameter and then try export it then i get the error message: Error in file.. Failed to load database information.
It also mentions the crdb_oracle.dll file.
Why does this happen when i pass a parameter. It works fine if i dont pass the parameter..?
Please help me..
TIA
Martin
Good. Thanks.
is there any sample using oracle database...
No, I'm sorry. But when you use the DataSet examples in my demo application, you could fill the tables with information from an Oracle database. The helper class has no Sql specific stuff.
How to show total number of pages in crystal report instead of 1+, 2+, 3+ ....
Show where? In the document is easy, it's a special field.
Hi Am try to create Document for JavaScript
Using Script Doc I creatd ORG(*.org) as well as (*.xml)
But i do not know how to generate Document using SandCastle ?
pls give any useful idea
You should check out the Sandcastle blog (blogs.msdn.com/sandcastle) and in particular this post: blogs.msdn.com/sandcastle/archive/2007/06/28/scriptdoc-1-0-for-extractiong-javascript-code-comments-is-now-available-at-codeplex.aspx
It describes a tool which you can use to extract comments for JavaScript.
Thanks Jan for this post. If you have any questions please let me know.
Hi Jan,
Maybe you can update the URL, since GotDotNet is a thing of the past: www.jtleigh.com/.../CopySourceAsHtml
Scanning the HTML is only 1/3th of the job. Look for changes in the .css and .js files as well (client-side ofcourse!). You can use the Developer Toolbar from Microsoft for this, or -in case of Firefox- something like Firebug.
Are you using stylesheets (CSS) or other external sources that might cause this behaviour?
Kind regards,
There are of course stylesheets involved. But they are very static, and I apply the same style sheet each time.
Hi,
how to use devMetrics in vs2005? I can't add devMetrics in vs2005.I do it according as MSDN,but I am failed.Can you helo me?
Thanks!
I really wouldn't know. I have not been able to use DevMetrics in vs2005 either
StripTimeFromDate was very useful for me. Thanks.
Only a few weeks after the September release of Sandcastle, Microsoft have already released the October
Pingback from Web 2.0 - Social Media - Internet News - Blogging » Sandcastle October 2007 CTP released
Pingback from Web 2.0 - Social Media - Internet News - Blogging » .Net Zip library
This is a bit off-topic, but can you tell me how to monitor traffic on a computer, such as writing to a USB drive or CD?
-Just thought a man of your talents would have some idea.
Thanks in advance,
JB
super many thanx
Have you seen Highlight? I believe it supports Soundex searches: www.shuffletext.com/Highlight
I am new to c#.Could any one please tell me the procedure to skip System Volume Information folder while scanning for all folders in a particular drive.
I just read here u can do it by catching UnauthorizedAccessException.I am not sure what to write inside the catch block so that my application countinues working even if it encounters this exception.
Thanks for your excellent code and this is useful for me.But, I like to know how can I get the assembly with their version name instead of file name.I have more than one assembly with the same name but different versions in the GAC.I want to get a specific version needed.How can I do this?
Some customers aren't even ready to make the switch to vs2005 .. same with sql 2000 ... we just have some servers switched to 2005 .. next year 2008 comes and 2000 isn't supported anymore at the end of next year .. hmmm .. some work to do here..
Wim
the netherlands has a very modern network of interstates . it is easy , to pass the country by in 2 - 3 hours . in earlier times i was often in the netherlands . the most modern motorways are in - for my opinion - around and in rotterdam , dortdrecht and the hague . it is good , that many motorways are illuminated since a few years .
I don't know about the COM exception, but I think you can avoid the use of ServerXMLHTTP30Class altogether using the following code:
HttpWebResponse response;
WebRequest request = HttpWebRequest.Create("http://www.bloggingabout.net");
request.Timeout = 5000;
try
{
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException wex)
response = (HttpWebResponse)wex.Response;
Console.WriteLine("{0} - {1}: {2}",
(int)response.StatusCode,
response.StatusCode,
response.StatusDescription);
I know this solution, but we abandoned it because it leans pretty heavy on the Exceptions thrown and it requires the server to render the entire request including rendering of the images. The ServerXMLHTTP30Class merely retrieves the response header. We did checks between both options and the ServerXMLHTTP30Class was faster.
You can add 1 line to only request the headers using the HttpWebRequest object, just like you do with [http.open("HEAD"...].
This should be just as fast:
request.Method = WebRequestMethods.Http.Head;
Thanks alot for your article...It was really helpful as I am having the same senario for my application.
A good thing is the first procedure gets optimised in SQL server 2005.
See this for more info:
milambda.blogspot.com/.../exists-or-not-exists-that-is-question.html
Maybe I missed something, but I don't find the "Add link" button on Visual Studio 2003, only on the 2005 version :/
How did you add a link with VS2003 ?
Yes, you missed something. On the open button in VS 2003 you will see an arrow down on the right-hand side. Click that, and you should be able to select link.
I know what's the problem : this trick doesn't work with an ASP.NET project. Damn, it would have been so useful :/
please give me the project
If we're going back as far as ME why not add MS-DOS 4.0 to the list?
Better yet Microsoft Access for DOS - a communications package that was quickly dropped and the name recycled a few years later for the database package we know today.
[)amien
I'm interested, but where's the article? :)
Sorry, but I forgot to add a link to the article. I updated the post, so have look!
Download and run WindowsXP-KB945007-x86-ENU.exe from windows downloads. This will solve your problem. If you are using Windows server 2003 then install and run WindowsServer2003-KB945007-x86-ENU.exe
I have been using your code with some modification and it works perfectly for me in the Prod environment.
Thanks a lot.
Yash
There is no project, just the steps I explain in this post.
Lista de esquemas de colores para Visual Studio 2005/2008 : Yo me quedo con la de Oren Ellenbogen poniendo
This is great! Thanks
Context, Context, Context. Fine arguments you guys pose, but what if you want to say display different messages based on the results of the condition? In that case nested if's with corresponding else's might be your best shot or setting variables as suggested, but then you will have to check the values in the variables again(more ifs)
Pingback from bloggingabout.net/.../Centralizing-AssemblyInfo-settings_2C00_-or-simplify-versioning-of-solutions.aspx
Construyendo comandos para consultas a base de datos, es un tema que siempre despierta interés y siempre
Pingback from bloggingabout.net/.../TechEd-_2D00_-Windows-Presentation-Foundation-_2800_WPF_2900_-in-the-Real-World_3A00_-Z_FC00_rich-Airport-Monitoring-System.aspx
I installed the redistribution msi but there was no files under system_web\2_0_50727?
But if i use the merge module I will get sub folders
Either way, I've done all that but am still getting image stubs aka red X on the image.. Any ideas? This is my third day trying to get my UAT machine back up..
I am using the Sandcastle Help File Builder v1604, Sandcastle January release 2008 and HTML Help WorkShop v1.3, and create a document in chm, my problem is that creates my file output class.chm without problem, but on having opened, I see the namespace, the methods, etc, but do not see your description, is empty. I need to solve urgently this problem, please help me.
Thanks,
Javier
Thanks, Your aaplication help me alot.
I enjoyed the article! :)
How does one connect an access DB using the tool. Btw great work! I have been using this component for a while on MSSQL but never on MS Access. How do I do it?
Pingback from Johan; thinking out loud. » Managing several AssemblyInfo files in Visual Studio
I wouldn't use an exception for flow control.
Using :
catch (IOException) { return false; }
is not a good idea.
But if it works for you then more power to you!
I just want to know the comments ///.... are essential for the sandcastle to understand or can i use
/*
<summary> some description </summary>
*/
instead
/// <summary>
/// some description
//</summary>
I have tried with the first one but it is giving me error as
D:\ProgramFiles\Sandcastle\Examples\sandcastle>csc /t:library /doc:comments2.xml test.cs
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
test.cs(18,18): warning CS1591: Missing XML comment for publicly visible type or member 'TestNamespace.StoredNumber'
D:\Program Files\Sandcastle\Examples\sandcastle>
Thanks Jan. Good article on CR..I just tried it and got the result. Keep your good work.
Hi
I am very much thankful for your effort in making such a wonderful piece of code.
May GOD Bless You
Destroying applications? Interesting..
I used too.. very nice. thanks.
Pingback from deploying a project in visual studio 2003
I am deploying a VS 2008 C# application, using Crystal Reports 9. Do I still use the VS 2008 merge modules, or should I use something else???
Is it worth it to convert to CR Basic for VS 2008???
StripTimeFromDate is very nice :)
Saved my Time :)
Keep up the good work.
Gr8 works fine!!
thank you for this information. I followed all these steps on a Windows 2008 Server and the app runs. However, when I select a report to display I get a yellow screen saying "fail to render page" and the reports dont show up. If, however, I click on one of the drilldown options I get data displayed.
This has something to do with the charts i have on the report, however, I have looked everywhere and have not been able to find any fix specific for Windows 2008 Server.
it say that the cast of toolstrip to the pageview and i get an error?
If you are using Crystal Reports for Visual Studio 2008, in order for your application to work when you deploy it, the most simple way to do it is to install on client computer the "Crystal Reports Basic for Visual Studio .NET 2008" msi package - see support.businessobjects.com/.../runtime.asp
After it installs, applications can use CR... very painless, and no need to use the merge modules
That is correct.
You could try and download the code for my Crystal Helper class here: www.codeproject.com/.../CrystalHelper.aspx. The helper class contains methods that do what I describe in this post. There's also a demo application in there that shows how the methods work.
Hey thats gr8 Information, this might also be helpful dotnetguts.blogspot.com/.../understanding-datetime-and-timespan-in.html
I cant get the event ::ViewerStatusBar & ViewerTabs, do we have to import any other classes?? Can any one help me?
i have a sql server named abc where i configure all the crystal reports. they work perfectly allright.
Now i take the published version on the deployment site. I change the sql server name to pqr and configure the web application.
But do i need to configure each and every crystal reports to the new server settings?
I do have a lot of reports.
if that is so i ll again have to publish them at the site.
cant i just make the changes in the web.config?
ViewerStatusBar and ViewerTabs are methods, not events. So when you want to use these methods to disable the tabs and/or status bar then you simply call them when the control will be displayed.
I find StyleCop quiet interesting, but I disagree with some of the rules and it's sad if you cannot configure them, so you cannot enforce your own corporate coding style.
What bugs me even more is that I have to "correct" all those issues manually so that tool does not save me any work, instead it causes even more.
That is why I prefer a tool that *automatically* applies our *custom* styles to the source. This is why I love ReSharper where you can define your own settings and it can even apply it to your whole solution at your fingertips.
So, my conclusion on StyleCop is: Nice idea, but barely handy.
I don't agree with some of rules either, but I tend to have that with almost all coding standards. All of them have one or more rules I don't really like or even completely oppose. However, Microsoft are promissing some degree of fine-tuning and will focus on automatic correction if that is possible. So for me this will do, eventhough ReSharper is better at customizing.
Wonderful, just wonderful. Thanks for sharing this, it's been a great help.
If there's one thing that developers usually just cannot (or will not) agree to, then it's Coding
StyleCop is not a Microsoft product. It was developed by a couple of Microsoft employees for their own product development. They decided to release it in public, because it might be of use to other developers. And it sure is useful! However, the rules in this tool should not be viewed as THE Microsoft coding guidelines rules. Feel free to turn off rules you don't like. For example, I always turn off the strange rule that says you should put your using statements for namespaces within a namespace declaration.
For more background info about StyleCop, see blogs.msdn.com/.../clearing-up-confusion.aspx
I use and have encouraged our team at work to use the Philips Coding Standards (www.tiobe.com/.../gemrcsharpcs.pdf) with a few defined exceptions:
- private members to be prefixed _ and be in camel case
- constants are in CAPS
I'm a big fan of not relying on syntax highlighting or intellisense to help guide the eye of the purpose of a line of code, so will utilise every case/punctuation method I can to help differentiate items.
And you're right, a standard is not a standard if people don't use it. While (I believe) my coding standards are exceptional (I must confess to a small amount of OCD in my styling of code!), others often don't see it as being quite so important. I think we have a happy medium, though. Any shared projects do tend to meet these standards.
Link Listing - July 26, 2008
Good to know Erwyn, thanks. I was under the impression that, although it was an internal tool that it would get more a Microsoft badge. Kinda like Sandcastle.
Great post. Thank you.
I blog every fews with some tech tips and code. Would you like to place a link under your favourite blogs if I would do the same? It's all legit. I have recently moved to another city and am in the process if setting up a .NET community for the local developers. The aim is to be the communication portal to Microsoft regarding .NET developer events and information.
The website address -> http://pedotnet.blogspot.com
Dave Coates
Port Elizabeth .NET Community
http://pedotnet.blogspot.com
Thanks Nathan. Interesting read, those Philips Coding Standards. I noticed also that a lot of the rules are found in FxCop. A number of them are also checked by StyleCop. Using those tools might help you enforce the coding standards.
Some of you brought another solution for importing text files to my attention. Thank you for that! For
I deploy the crystal report. My application runs fine but when clicking the button which tries to launch a crystal report my problem. It gives a Microsoft C++ Runtime Library Runtime Error! Program: C:/windows/Microsoft.Net/Framework/v.2.0.50727/aspnet_wp.exe and if clicked finally it takes me to the Service Application Unavailable.
Please advice. This is very urgent and because of this problem we did not deploy this in client for the past two months.
report uses charts. works fine on development machine
when I call from FlexBuilder, the chart report does not work
note: other reports which only display data records work fine.
the space where the charts should be displayed contain the following two lines
CrystalReportViewer - CrystalReportViewer1
Error: Fail to render the page.
please help me
Because I blog about Crystal Reports occasionally, and created a helper class to assist in integrating
I'm really sorry, but I don't have all the answers to problems you all may have with Crystal. But check out this bloggingabout.net/.../need-help-with-crystal-reports-look-here.aspx" or this bloggingabout.net/.../sap-is-annoying-me.aspx". These posts contain links to web sites that may help you solve the problems you might have.
Download merge modules for VS2005 link is not working.
The businessobject site redirects mr to
www.businessobjects.com/.../default.asp
Can you please give me the latest link to download merge module for VS2005
The people from SAP have changed the entire website, so the links don't work anymore. Please check this link for updates: bloggingabout.net/.../need-help-with-crystal-reports-look-here.aspx
While normally I'd agree with Ashely above about not using exceptions to control flow, in the case of a file being in use by another process, I've never found another way of doing it.
So, I'd do it your way.
The other thing I added to yours was:
catch (UnauthorizedAccessException)
{ return false; }
below the IOException catch. I hit this when copying whole directories over to the site I'm watching, and I have the watcher set to monitor subdirectories.
Thanks for the article.
Excellent article. This was just what the doctor ordered. Worked first time, and allowed me to integrate into the project I was working on.
Thanks
I was able to deploy a report in a .NET 2003 project. There were some issues with the graphic images and since we are upgrading to VS 2008 in a month I went ahead and downloaded VS 2008 eval early. I ran the redistributable msi on my development web server but I'm getting 'OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT' error on the report. In my 2003 project I had to create a virtual directory that pointed to the Crystal dll's. to resolve this. I've tried that on my 2008 project but no joy. I've problaby have named the virtual wrong as I can't find any documentation for 2008. I found the 2003 documentation here: boc.sdn.sap.com/.../235 Ideas?
I have no idea. My best guess is to post this question either in the sap Crystal Reports forum (for links see here: bloggingabout.net/.../sap-is-annoying-me.aspx) or in the Microsoft Crystal Forum: forums.msdn.microsoft.com/.../threads
Thank you for posting this. It works very well. The VB.NET 2008 version is:
Private Sub HideCrystalViewerTab()
Dim tempcontrol As TabControl = crtPDFView.Controls(0).Controls(0)
With tempcontrol
.ItemSize = New Size(0, 1)
.SizeMode = TabSizeMode.Fixed
.Appearance = TabAppearance.Buttons
End With
End Sub
mergemodule for Crystal report 2008 required
Check the links in the post. And look at the download section of the SAP portal for Crystal Reports.
The problem is occurring because you have to check out the bin and obj folders in your project. When you check out the project, it doesn't automatically checkout the bin and obj folders. I hope this helps
yes, that usually locks the files. I never check in objects or binaries. So still don't understand why this happened. It only happened once.
This is how you deploy Crystal to a Web Site with Visual Studio 2008.
1.Install the CRRedist2008_x86.msi on the web server
2.You will also need to copy a directory and its contents from your computer to the root web of any web site that you create Crystal Reports in. On my computer this directory was located at: C:\Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer4 You will need to copy it in the aspnet_client\system_web\2_0_50727 folder of the root web you are installing the Crystal Report application. See forums.asp.net/.../992330.aspx for additional information - this fixes problems with the Crystal Toolbar.
3. When you create a report within your asp.net application, it will not publish by default. You need to change the properties on the report. I haven't experimented a lot with these but changing the Build Action to "Content" and the Copy to Output Directory to either "Copy on Newer" or "Copy always" worked for me.
4. I also experienced fewer problems if when I published, I chose to Delete existing files.
The following VB code sample is provided for anyone else who is struggling with passing parameters via a querystring. This is much simpler than most of the examples that I found on the net.
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Partial Public Class myASPNETPAGE
Inherits System.Web.UI.Page
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
Dim myReport As New TheReportName
myReport.Load(Server.MapPath("TheReportName.rpt"))
myReport.SetParameterValue("@Par1", CInt(Request.QueryString("P1")))
myReport.SetParameterValue("@Par2", Request.QueryString("P2"))
'Connection Info
Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
Dim myTableLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim myDatabase = myReport.Database
Dim myTables = myDatabase.Tables
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
myConnectionInfo.ServerName = "DatabaseServer"
myConnectionInfo.DatabaseName = "Database"
myConnectionInfo.UserID = "UserAccount"
myConnectionInfo.Password = "Password"
For Each myTable In myTables
myTableLogOnInfo = myTable.LogOnInfo
myTableLogOnInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogOnInfo)
Next
CrystalReportViewer1.ReportSource = myReport
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As EventArgs) Handles CrystalReportViewer1.Init
End Class
Have you ever seen this error: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.
I have installed the Redist. and the Merge Modules, changed the web.config, but get this error.
Any suggestions?
Thank you so much! It helps me a lot!
How to change the CrystalReportViewer to read MyProject/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/html ,not root/aspnet_client?
thanks
Post your questions here www.sdn.sap.com/.../businessobjects-forums
or here forums.msdn.microsoft.com/.../threads.
I'm sure someone knows the answer and perhaps you can even find the answer to your question there already.
Excellent job... how u solve all this. how much experienced u r.
Link Listing - August 21, 2008
Your listings above talk about the visual studio 6 family but the links go to newer versions (probably due to Microsoft changing the content)
thanks god...for the link, i've been waiting for anyone to show me that link, i hate Business Objects
own Crystal Reports..
i was able to deploy CR in VS .Net 2003, but also have
got another problem. the export, print, and other CR View toolbar doesn't appear corectly. the condition was:in my form i'm using tab control that have view tabpage and there's a CR view for each tab page...it doesn't happen before i deploy it...why is it possible...ideas???????????
Is it an ASP.Net of WinForms application
The links point to pages for Visual Studio .Net versions, and show the short-cuts when you select one of the predefined schemes.
I need to know how can i make my c# windows application works on any machine including it's crystal reports
the other thing that how can i make ready to work from my USB Flash (Pen )
greetings
Yusif, please take time to follow the links in the post. they will point you to forum sites about Crystal reports where you can get answers to your questions.
Hi i tried to work in crystal report project deployment.Please send step by step deployment process...Advance thanks
I have been searching these links for many days.
You have saved my time .
Thanks Again !!!
Hello, first of all thank you for the code.
I'm getting this error: "These columns don't currently have unique values" so i still can't work with the column information :( please help
i need a link to download crystal report mergemodule for 2005.The link is redirected to sap.i could not find that.can u help me out
The download link for VS2005 and CR12 Redist is as follows.
websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm
You might need to register and then download.
how i set a parameter manually in code
I used the steps above and disabled some options in the settings. But even after i do apply and ok, it seems the settings are not saved. When i open the settings file next time, everything is checked and enabled. What could be the problem?
Good work, I have used it and it has copied the DLLs from the GAC. Thanks
I have search fo a lot and your link works for me
partilcularly
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports on your machine
I want to build a small program that will allow me to hide my ip and browse anonymously. Any help ?
thanks in advance
Good Article! and timely!
I am trying to use the Jet engine to import a text file using a pipe (|) as the delimiter.
Have you had the opportunity to try "HDR=Yes;FMT=Delimited(|)" ?
OleDbDataAdapter.Fill seems to insist that the delimiter must be a comma. Using a pipe causes the entire header row to be considered the header of the first and only column.
No, I never have. But perhaps you should look at filehelper.com. They have excellent (FREE) component that handles this.
Great !!
I am really happy to know that you care others.
Programmer vs Good human being
Thanks a lot !!!
Really helpful.
I got the same problem too! but on crystal reports on windows forms and your explanations helped resolved this issue.
Error:
"Error occured creating the form. See exception.innerexception for details. Error is :the type initializer for 'crystaldecision.crystalreports.engine.reportdocument' threw an exception."
Solution:
Deployment machine did not have the "Crystal Reports for .NET Framework 2.0" installed, which is required by Crystal Reports configured on forms using Visual Studio.NET 2005.
Copy over the file "CRRedist2005_x86.msi" in the development machine's directory "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports" and paste it in your bin folder of your solution directory. When you create the setup files for you application, On the solution explorer, right-click you application setup and click properties > Prerequisites, check Crystal Reports for .NET Framework 2.0, and select second option down for the location. In you File system under your bin folder for your setup add file "CRRedist2005_x86.msi" in from the location copied to earlier, rebuld your solution and try installing.
Note that it worked for me my development & deployment environment, it may or may not work for you. Main thing though is to cnfirm all prerequisites before rushing into deployment.
Pingback from Recent URLs tagged Pocketpc - Urlrecorder
Agreed the commandbuilder auto generates the commands, but after deployment if the table design changes you will still have to create new paramters for the command text. Having said that this is not a bas solution at all, just not ideal.
Not quite true. The commands are generated, but so are the parameters. As long as the design only adds new columns, then the only reason for changing the code is when non null columns have been added.
It looks like a bug. As soon as you check one optionbox the root optionbox is checked also. It should be greyed out.
I am now looking for a solution. Do you know anything more?
Make sure you stylecop is not running. Perhaps even close Visual Studio and try again. I have no problems with changing the settings. If you continue to keep these problems, access this link (blogs.msdn.com/sourceanalysis) and go from there.
In registry, I forced tabdelimter (TABDelimited) which I was used for one of my project. Now for requirement i need to process comma delimiter file. i used following code,
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\;Extended Properties=\"text;HDR=YES;FMT=Delimited(,)\"");
it returns only first column.
If i change the registry then it workd fine.
pls. help me to fix.
Priyan
You need to remove the entry from the registry and think about implementing filehelper. For information, look here: bloggingabout.net/.../another-solution-to-import-text-files-tab-csv-custom.aspx
i am working on .net 1.1, crystalreports.
i develop a pie chart,
when i run application in my local meachine cr navigation button images, chart images are not displaying. i am getting red cross mark in place of chart.
pl help me, very urgent
Try to download the redistributables for .Net 1.1 from the SAP site and re-install them onto your development machine.
Jan, for your second scenario you could do the following:
1. Remove the protected variables for the controls from the normal code behind cs file.
2. Delete the designer.cs file
3. Right-click on the aspx file, and select Convert to Web Application.
This technique also works for the dreaded "Unable to connect to undo manager of source file...".
Thanks for you solution, it works!
Moreshwar
Pingback from Reflective Perspective - Chris Alcock » The Morning Brew #206
need link for merge module for visual studio 2005
Because [s]he doesn't know the correct syntax or workings of the ?: construction ?
Some 'developers' have no clue about what they are doing. So they become project managers and complain about projects not finished in time ;-)
great article.
I tried to to load tab delimited files, and it works fine, but when I think big, theres something wrong. When I load a 270Mb file wih 1.7 mio rows the memory for the process is about 3 times the file, going up to aroung 850Mb.
How can I prevent that? or should I go for another solution? I only need to view, not edit the file. and I'm totally new to C#.
Kim
You might want to look at bloggingabout.net/.../another-solution-to-import-text-files-tab-csv-custom.aspx and use FileHelper
Thanks, it was helpfull :)
I am installing an application of C# . Have installed Crystal 9.0 Redistributable but getting an error of
Failed to load database information ?
Can anyone help ?
Thanks Jan Schreuder for this great topic. :)
Crystal Report's Merge Modules can be found here:
www.sdn.sap.com/.../wiki
This is really useful! I'm debugging two services at the moment (one is dependent on the other but isn't configured as such) so this is much appreciated.
A very good information provided.. thanks a tonn for the same..
Abhay
Thanks for the solution but the FileStream is locking the file for reading and you cannot move it anyway…. So I’m getting the same error…. (IO the file is used by another program)
how to clear on a crystal report
how can I generate description information into the generated .chm file?
[source code]
/// Gets a value that is used to convert twips to pixels based on screen settings.
/// <returns>The conversion factor.</returns>
/// </summary>
public float TwipsPerPixelY
[generated information]
Name Description
TwipsPerPixelY - an empty description -
Thanks a lot!!!!!!!!!!!!!!!!
the code worked for me
Thnx ya.
Pingback from Common Assembly Attributes « Coding for Fun and Profit
Thank you for this wonderful article. This is what i need for my windows application.
jemtech007
I need to document web services and xml schemas.
How to pass?
Pass what?
Thanks for sharing
cheers
Hello I have downloaded the Crystal Reports for VS .NET 2005 - Redistributable from the link you provided however i am unable to pass parameters to my reports. Is there any way to fix this
I need to make it running inside the build script. What would be the SandcastleBuilderConsole.exe parameters?
Check my Crystal helper class at www.codeproject.com/.../CrystalHelper.aspx or post your problem here: https://boc.sdn.sap.com/ which is the SAP help site
Not sure. But why not check out the forum at the CodePlex or switch to DocProject. DocProject allows you to create a .Net project inside your solution and generate the documentation from inside Visual Studio. And since it is a .Net project, you can simply build the project created using a build script.
NDoc is giving me problems. I installed the GUI version from the link above. It will build XML documentation, but it is not very readable. I tried to generate the othe forms of documentation, but I got errors. I was most interested in the Linear HTML. Does anyone have any advice?
Justin
Switch to SandCastle. Read my topics on this.
Thanx for the article.....
I was wondering what happens when there are multiple files being uploaded to the directory that is being monitored? How is that handled? Does the created event get fired multiple times at the same time.
I have a situation where I have to monitor a Directory where Incoming Fax Files are being saved by the Fax Server. I have to examine every file and figure out if its a multipage Tiff, if it is then I have to split the file into multiple files ( I have got the Tiff part going ) but I'm wondering about multiple fax files being written to the directory.
Can someone please explain....Appreciate all the help.
Thanx
NDoc had and my still even have the limitation that it requires an XML file to be generated by Visual Studio in order to generate the documentation file. This tend to be a problem with ASP.NET websites.
Alternatively you could take a look at Doxygen (www.doxygen.org) in combination with graphviz (www.graphviz.org). Both are open source tools.
With doxygen you can add additional information to your documentation such as a to do list, a test list, a bug list and additional documentation pages. It can even prepare the output so that it can be directly compiled into CHM file using the HTML Help WorkShop.
Graphviz is used to generate things like the call and caller graphs for a given method.
DoxyGen can be used for any C#.NET project as it scans the source files outside the IDE for XML documentation. Not sure how it performs on VB.NET project though.
Arjan
I know this is an old post, but I thought I would throw my 2 cents in here. You really should hold onto your reference to the FileStream, rather than closing it immediately. What is something else comes along and gets a hold of your file between the time you return from "FileUploadCompleted" and your call to "Process"?
How come I can't find the TabControl type, what namespace do I need? Thanks
You have a point there. The solution here is simply to explain the principle. Depending on your needs, you should keep the FileStream reference. In this case, the method was just to see if the file was in use. And then you don't really need to keep the reference.
depends on which tab control you need, the Windows version or the Crystal version. If you have VS 2005, try resolve to find the namespace.
for some reason, both links don't work for me.
The links are correct. But I'm experiencing problems as well. It looks as if blogs.msdn.com is not responding
Just what I was looking for.. Thanks!!
Could you please add an example or a link to add a User Defined tag in the compiled CHM file.
santosh
Santosh. Can you check this link blogs.msdn.com/.../supporting-custom-tags-in-sandcastle.aspx. If that is not the information you need, please post your question on the Developer documentation and Help System forum: social.msdn.microsoft.com/.../threads
Thanks Jan,
am able to add the new tag by modifying the main_sandcastle.xsl and the configuration files available in the Program Files\Sandcastle\Presentation\vs2005\Content folder.
what happens when there are multiple files being uploaded to the directory that is being monitored? How is that handled? Does the created event get fired multiple times at the same time.
Answer to the Furqan Iqbal's question is yet not been posted. Can someone answer this? appreciate all the help.... greatly awaited..
Thank You!
I spent a lot of time trying to solve this issue. Your solution works perfectly.
I recently read this wich I haven't probed yet:
I have the professional edition of Visual Studio 2008. After poking around in VS 2008 Setup and Deployment project I found a the following:
1) Right Click on setup project in the solution explorer
2) Click Properties
3) There is a button called "Prerequisites" click it
4) in the list you will find "Crystal Reports Basic for Visual Studio 2008(x86, x64)
5) Check it off
After doing that your project will now include the CRRedist Files.
When you run the install it will install them and everything works fine.
Hello: Now I have tested the above steps and It worked fine, all the crystal reports included in the project showed perfectly.
There are a lot of people running the Crystal .msi program separately and even trying to integrate in the setup program manually.
So I thank the author of the above comment: Robert McArthur from MSDN.
thanks i needed this
I am deploying a windows VS 2008 C# app that includes CR and Business Objects 12.0 as well. I don't understand how this CR and Business Objects 12.0 relationship works, but I'm having a problem.
I have installed the CR runtimes (tried small version, full version and both together) on the target windows server 2003 server.
When the app consumes the rpt file, the CR app throws an error saying u25azalea.dll is missing. I find this dll in the Business Objects 12.0 folder on my development machine and try to include it on the deployment but no luck.
I guess Business Objects 12.0 in not a part of any of the CR runtimes, does that mean I need to buy Business Objects 12.0 for every target server? I have also tried to embedd the CR rpt in the C# app and deploy, same error.
Thx,
The first monday of the month was great for me
Thank goodness for your article. I could not for the life of me figure out how to make these tools work. You are a God-send! :)
Thanks mate.
In my scenario Crystal was running within a System Service (service generates and send reports via email). The problem was with those reports that has a graphic.
I just added in my app.config this lines:
<add key="CrystalImageCleaner-AutoStart" value="true"/>
<add key="CrystalImageCleaner-Sleep" value="60000"/>
<add key="CrystalImageCleaner-Age" value="120000"/>
How can I strip the date off of a time, so I can compare two times?
strip time from date works fine for that purpose
Thanks for your work. I've got 1 question: what event i should process to change name of subreport?
should i work only with "CRRedist2005_x86.msi"
but i have CRRedist2005_X64. Error occurs.
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports
solution please
I am using the .net inbuild Crystal Report.In this When I click on the Print button in Toolbar print dialog box is not comming. It is Just showing a White dialogbox and it shuold be get disappear after some time. Please mail me if anybody have a solution on diliptkumar14 --- hotmail.com
Thanks in advance
Dilip Tiwari
Close ur Running Application and Delete the /obj/ folder.
Thank you very much. It was pretty useful.
Same problem
Many thanks. just started getting that error after editing a fiddely page in (which has been upgraded from .Net1.1 )in VS 2008 - the protected / delete designer.cs and convert to web app solved it for me!
Thanks for taking the time to put this solution up there...
i suggest you go:
connect.microsoft.com/.../ViewFeedback.aspx
and let them know the solution :)
Ugh... sorry, Sandcastle is the biggest piece of crap since Mac OS X. Here's why: userunfriendly.wordpress.com/.../sandcastle-built-on-quicksand
Very useful.. exactly what I was looking for.
I have a problem opening the report in crystalreportviewer. whenever i first time open the report it goes to sleep. alomst takes 45 secs - 1 minute or more to open it.
but in the same run if i open the report again it shows like it has everything in it.
is there any way to speed up the first time loading time of the viewer in dot net 2005.
i am using csharp code.
msherazkhan@gmail.com
I think, judging by your comment, that the queries that retrieve the data take long to run. The second time, the data will be in the system cache, so it will be returned to your report faster. Try checking the time it takes to retrieve the data for your report, and see if the queries can be optimized.
If you use DataSet objects, try populating them in a separate thread. That will allow you to load the data while your application is waiting for the user to select the report.
Very nice, but is there any way to do something like this for C++ code in Visual Studio?
I don't know, but you could try to use this solution in C++. Perhaps it works in VS 2005 and up. I know that XML and ASPX can be formatted in these versions using the same trick as the C# code.
How can I do this in VS 2008 VB.net project?
I don't see Build tab / Conditional compilation symbols in the project properties.
Appreciate your quick reply.
Thank you,
Sekhar Aripaka
great article !! great explanation, it worked at the first try, thanks!
but in case of web projects or web services how it works?
An error has occurred while attempting to load the Crystal Reports runtime.
Either the Crystal Reports registry key permissions are insufficient or the Crystal Reports runtime is not installed correctly.
Please install the appropriate Crystal Reports redistributable (CRRedist*.msi) containing the correct version of the Crystal Reports runtime (x86, x64, or Itanium) required. Please go to www.businessobjects.com/support for more information.
Thanks for your article.
I was pleased to use FileSystemWatcher to monitor my application directory. But when I tried to copy a couple of files there some of them did not reflected in my application. Then I found that I had some problem like you and files were still creating.
I will use your solution because it solves the problem very well I think.
I have followed all the procedures to deploy a reporting site on win 2008 server but the chart images
are not showing up. instead it is showing [X]image.
check the following link
csharp.net-informations.com/.../csharp-crystal-reports-string-parameter.htm
gev.
You can also do this:
Select All: [CTRL] + A
Cut: [CTRL] + X
Paste: [CTRL] + Y
I got the required information from blogs.msdn.com/.../559149.aspx
It works!!
Greate it really works !
I opened up some code today to find that a coworker who needed to change something decided to have ReSharper remove most of the parenthesis when if/else blocks had a single statement...
having parenthesis on if/else blocks with a single statement is a matter of opinion. I myself would smack the person that removed them, I always add parenthesis. It can prevent errors.
Hi all,
I got the crystal report problem solved by installing Crystal Report 2008. Their is no other ways. You don't need to convert the crystal reports done in 10.0.3600.0 to crystal report 2008, the only thing you have to do is
After installing Crystal Report 2008 make changes in the web config like this
<compilation debug="true">
<assemblies>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Enterprise.Framework, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Enterprise.InfoStore, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</assemblies>
</compilation>
You need to change in http handler section also
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>
After making these changes the next step is you have to change the web form from where the report is calling
ie,
<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
Change it to
<%@ Register Assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
Remember that DisplayGroupTree option will not support in source for CR 2008
So if any thing exists you should remove that thing like
<cr:crystalreportviewer id="crvPayGraph" runat="server" autodatabind="true" DisplayGroupTree="False" EnableDrillDown="False" OnDataBinding="crvPayGraph_DataBinding"></cr:crystalreportviewer>
You should omit that part DisplayGroupTree="False"
Instead you can provide it in the code section as
crvPayGraph.DisplayGroupTree=false;
crvPayGraph.PageZoomFactor=100;
Why I gave this thing crvPayGraph.PageZoomFactor=100 is sometimes the graph will load with zoom factor 150%.
Hope this article will help everyone struggling with Crystal Report problem.
Hugely helpful application. Thanks for this.
Thank a lot... for an wonderful article.
Thanks For The code....
I convert it to subtraction method...
It subtracts the given number only if its a working day.
DateTime SubtractWorkingDays(DateTime beginDate, int Num)
DateTime procDate = new DateTime();
procDate = beginDate;
int realDays = 0;
while (Num > 0)
switch (procDate.DayOfWeek)
case DayOfWeek.Saturday:
realDays++;
procDate = procDate.AddDays(-1);
continue;
case DayOfWeek.Sunday:
default:
Num--;
} return beginDate.AddDays(-realDays);
thanks...
Thank you Jan !
that was helpful, was working on a tight timeline.
it saved me some of it.
I like the code and the event support. Thanks!
1. I believe the search pattern solution will cause an individual file to be processed N times in the event that N of the search patterns match the file.
2. Does *.* search pattern behave the same as * with regard to extensionless files?
Cheers,
Dave
RaiseDirectoryEvent has some File/Directory inconsistency.
1. Should "if (FileEvent != null)" be "if (DirectoryEvent != null)"
2. Should "for the file event" be "for the directory event".
If you are interested, here is a revision of the code that...
1. fires events for UnauthorizedAccessException and continues scanning subsequent directories
2. fixes file/directory inconsistencies in RaiseDirectoryEvent()
a. changed FileEvent to DirectoryEvent
b. changed "for the file event" to "for the directory event"
3. initializes the _searchPattern = _patternAllFiles
(to avoid "System.NullReferenceException: Object reference not set to an instance of an object." in certain cases)
4. added a note about the search pattern logic fallout (redundant file processing)
Note:
The construction of the new try/catch blocks is critical (i.e., not bracketing more code than is necessary). This ensures proper processing when 1. scanning directories only and 2. scanning directories and files.
namespace ScanDirectoryDemo
/// Defines the action on a directory which triggered the event
public enum ScanDirectoryAction
/// Enter a directory
Enter,
/// Leave a directory
Leave
#region Event argument definition for ScanDirectory.FileEvent
/// Information about the file in the current directory.
public class FileEventArgs : EventArgs
#region Constructors
/// Block the default constructor.
private FileEventArgs() { }
/// Initializes a new instance of the <see cref="DirectoryEventArgs"/> class.
/// <param name="fileInfo"><see cref="FileInfo"/> object for the current file.</param>
internal FileEventArgs(FileInfo fileInfo)
if (fileInfo == null) throw new ArgumentNullException("fileInfo");
// Get File information
_fileInfo = fileInfo;
#endregion
#region Properties
private bool _cancel;
private FileInfo _fileInfo;
/// Gets the current file information.
/// <value>The <see cref="FileInfo"/> object for the current file.</value>
public FileInfo Info
get { return _fileInfo; }
/// Gets or sets a value indicating whether to cancel the directory scan.
/// <value>
/// <see langword="true"/> if the scan must be cancelled; otherwise, <see langword="false"/>.
/// </value>
public bool Cancel
get { return _cancel; }
set { _cancel = value; }
#region Event argument definition for ScanDirectory.DirectoryEvent
/// Event arguments for the DirectoryEvent
public class DirectoryEventArgs : EventArgs
private DirectoryEventArgs() { }
/// <param name="directory"><see cref="DirectoryInfo"/> object for the current path.</param>
/// <param name="action">The action.</param>
internal DirectoryEventArgs(DirectoryInfo directory, ScanDirectoryAction action)
if (directory == null) throw new ArgumentNullException("directory");
_directoryInfo = directory;
_action = action;
private DirectoryInfo _directoryInfo;
private ScanDirectoryAction _action;
/// Gets the current directory information.
/// <value>The <see cref="DirectoryInfo"/> object for the current directory.</value>
public DirectoryInfo Info
get { return _directoryInfo; }
/// Gets the current directory action.
/// <value>The <see cref="ScanDirectoryAction"/> action value.</value>
public ScanDirectoryAction Action
get { return _action; }
#region Event argument definition for ScanDirectory.UnauthorizedAccessExceptionEvent
/// Event arguments for the UnauthorizedAccessExceptionEvent
public class UnauthorizedAccessExceptionEventArgs : EventArgs
private UnauthorizedAccessExceptionEventArgs() { }
/// Initializes a new instance of the <see cref="UnauthorizedAccessExceptionEventArgs"/> class.
internal UnauthorizedAccessExceptionEventArgs(DirectoryInfo directory, UnauthorizedAccessException exception)
_exception = exception;
private UnauthorizedAccessException _exception;
/// Gets the current UnauthorizedAccessException.
/// <value>The <see cref="UnauthorizedAccessException"/> exception value.</value>
public UnauthorizedAccessException Exception
get { return _exception; }
/// Scan directory trees
public class ScanDirectory
private const string _patternAllFiles = "*.*";
#region Handling of the FileEvent
/// Definition for the FileEvent.
public delegate void FileEventHandler(object sender, FileEventArgs e);
/// Event is raised for each file in a directory.
public event FileEventHandler FileEvent;
/// Raises the file event.
private bool RaiseFileEvent(FileInfo fileInfo)
bool continueScan = true;
// Create a new argument object for the file event.
FileEventArgs args = new FileEventArgs(fileInfo);
// Now raise the event.
FileEvent(this, args);
continueScan = !args.Cancel;
return continueScan;
#region Handling of the DirectoryEvent
/// Definition for the DirectoryEvent.
public delegate void DirectoryEventHandler(object sender, DirectoryEventArgs e);
/// Event is raised for each directory.
public event DirectoryEventHandler DirectoryEvent;
/// Raises the directory event.
/// <param name="action">The <see cref="ScanDirectoryAction"/> action value.</param>
/// <returns><see langword="true"/> when the scan is allowed to continue. <see langword="false"/> if otherwise;</returns>
private bool RaiseDirectoryEvent(DirectoryInfo directory, ScanDirectoryAction action)
// Only do something when the event has been declared.
if (DirectoryEvent != null)
// Create a new argument object for the directory event.
DirectoryEventArgs args = new DirectoryEventArgs(directory, action);
DirectoryEvent(this, args);
#region Handling of the UnauthorizedAccessExceptionEvent
/// Definition for the UnauthorizedAccessExceptionEvent.
public delegate void UnauthorizedAccessExceptionEventHandler(object sender, UnauthorizedAccessExceptionEventArgs e);
/// Event is raised for each UnauthorizedAccessException.
public event UnauthorizedAccessExceptionEventHandler UnauthorizedAccessExceptionEvent;
/// Raises the UnauthorizedAccessException event.
/// <param name="exception">The <see cref="UnauthorizedAccessException"/> action value.</param>
private bool RaiseUnauthorizedAccessExceptionEvent(DirectoryInfo directory, UnauthorizedAccessException exception)
if (UnauthorizedAccessExceptionEvent != null)
// Create a new argument object for the UnauthorizedAccessException event.
UnauthorizedAccessExceptionEventArgs args = new UnauthorizedAccessExceptionEventArgs(directory, exception);
UnauthorizedAccessExceptionEvent(this, args);
#region Public methods
/// Walks the specified path.
/// <param name="path">The path.</param>
/// <returns><see langword="true"/> when the scan finished without being interupted. <see langword="false"/> if otherwise;</returns>
public bool WalkDirectory(string path)
// Validate path argument.
if (path == null || path.Length == 0) throw new ArgumentNullException("path");
return WalkDirectory(new DirectoryInfo(path));
/// Walks the specified directory.
public bool WalkDirectory(DirectoryInfo directory)
if (directory == null)
throw new ArgumentNullException("directory");
return WalkDirectories(directory);
#region Overridable methods
/// Processes the directory.
/// <param name="directoryInfo">The directory info.</param>
public virtual bool ProcessDirectory(DirectoryInfo directoryInfo, ScanDirectoryAction action)
return RaiseDirectoryEvent(directoryInfo, action);
return true;
/// Processes the file.
/// <param name="fileInfo">The file info.</param>
public virtual bool ProcessFile(FileInfo fileInfo)
if (FileEvent != null)
RaiseFileEvent(fileInfo);
#region Private methods
/// Walks the directory tree starting at the specified directory.
/// <param name="directory"><see cref="DirectoryInfo"/> object for the current directory.</param>
private bool WalkDirectories(DirectoryInfo directory)
if (continueScan = ProcessDirectory(directory, ScanDirectoryAction.Enter))
// Only scan the files in this path when a file event was specified
if (this.FileEvent != null)
continueScan = WalkFilesInDirectory(directory);
if (continueScan)
DirectoryInfo[] subDirectories;
subDirectories = directory.GetDirectories();
catch (UnauthorizedAccessException e)
Console.WriteLine("UnauthorizedAccessException in " + directory.FullName + "("+e.Message+")");
subDirectories = null;
if (subDirectories != null)
foreach (DirectoryInfo subDirectory in subDirectories)
// It is possible that users create a recursive directory by mounting a drive
// into an existing directory on that same drive. If so, the attributes
// will have the ReparsePoint flag active. The directory is then skipped.
// See: blogs.msdn.com/.../332704.aspx
if ((subDirectory.Attributes & FileAttributes.ReparsePoint) != 0)
if (!(continueScan = WalkDirectory(subDirectory)))
break;
continueScan = this.ProcessDirectory(directory, ScanDirectoryAction.Leave);
/// Walks the directory tree starting at the specified path.
/// <returns><see langword="true"/> when the scan was cancelled. <see langword="false"/> if otherwise;</returns>
private bool WalkFilesInDirectory(DirectoryInfo directory)
// Break up the search pattern in separate patterns
string [] searchPatterns = _searchPattern.Split(';');
/**
* tempdt
* This search pattern strategy will cause files to be hit in order of
* the search pattern. Also, is it possible we get dups when a file matches
* more than 1 of the patterns?
// Try to find files for each search pattern
foreach (string searchPattern in searchPatterns)
if (!continueScan)
// Identify all files in the current path
FileInfo[] files;
files = directory.GetFiles(searchPattern);
Console.WriteLine("UnauthorizedAccessException in " + directory.FullName + "(" + e.Message + ")");
files = null;
// Scan all files in the current path
if (files != null)
foreach (FileInfo file in files)
if (!(continueScan = this.ProcessFile(file)))
private string _searchPattern = _patternAllFiles;
/// Gets or sets the search pattern.
/// <example>
/// You can specify more than one seach pattern
/// </example>
/// <value>The search pattern.</value>
public string SearchPattern
get { return _searchPattern; }
set
// When an empty value is specified, the search pattern will be the default (= *.*)
if (value == null || value.Trim().Length == 0)
_searchPattern = _patternAllFiles;
else
_searchPattern = value;
// make sure the pattern does not end with a semi-colon
_searchPattern = _searchPattern.TrimEnd(new char [] {';'});
Hello sir,
I want to the required coding.
Thanking you
Just wanted to know...what is this "SELECT TOP 1 1 FROM DELETED" in the trigger....what does it do......
the code is in this blog post.
What that does is returning 1 when there is at least one entry in the Delete table. It's an indication that data is removed from the table on which you have created the trigger.
Be aware that Title casing isn't correct linguistically, particularly for non-English languages. (In English we don't title case words like "of" and "a").
Funny I came across this when I was about to do this as my first blog here.
I often find myself writing code to bridge the little differences between VB (my preferred langauge) and C# for other developers so that we can all be on the same page.
VB has always had the StrConv() method/function which accepts as a parameter the type of conversion you want to make.
With the advent of .NET 3.5 and extension methods, I have written this into a class library for my C# based colleagues so that we can do the same kind of processing for certain fields in our applications.
We always Title Case (Proper Case in VB) customer names and job titles but the C# guys had no way of doing this. I then wrote a little utility class for them with extension methods that look like so..
//This is air-code so excuse any errors
public static class StringExtensions
public static string ToTitle(this string input)
return input.ToTitle(System.Globalization.CultureInfo.CurrentCulture);
public static string ToTitle(this string input, System.Globalization.CultureInfo culture)
return culture.TextInfo.ToTitleCase(input);
public static string ToTitleInvariant(this string input)
return input.ToTitle(System.Globalization.CultureInfo.InvariantCulture);
You would then call this like a method on the string class and it gets everyone on the same page.
thanks for sharing!
Thanks so much...
You've saved me a lot of time!
I'm sure you've heard of thedailywtf.com? To some developers, index=speed, so why not index every column to make it as fast as possible.
If you are looking for the physical location where your GACed DLL is saved in the file system, try this:
start-->run-->c:\windows\assembly\gac
If you don't find your DLL related folder in there, you can do a "Up" folder in windows explorer to display everything in c:\windows\assembly as folder structures. You can then look for your DLL under GAC_MSIL or any other folder out there....
Once, you identify your DLL, you can copy it as you normally do with windows explorer. Hope this helps!
Srikanth
This worked for me:
In *.csproj files, change
<DebugType>pdbonly</DebugType> and <DebugType>full</DebugType>
to <DebugType>none</DebugType>
nice post...
What if a new field is added to a table?
Then this version of the trigger is going to break. You have to consider two options here.
You could modify the script to select the columns by name, rather then a simple *. When you add a column, the trigger will not break, but changes made to the new column will not be audited.
Or leave it as it is, and ensure you add the new column to both tables. You'd have to make sure the columns in both tables are in identical order.
Having to maintain two set of tables could be a headache.
I just modified the trigger so now it can create and audit new columns on the fly. I removed both "update" and "insert" logic since I'm only using on-delete
There are still some issues, like if TRG_ACTION and TRG_DATE are removed from the audit table, or if the datatype is changed in a column. But that could be easily added.
Thank you very much for the code.
CREATE TRIGGER ##YOUR_TABLE##_Delete
ON [DBO].[##YOUR_TABLE##]
AFTER DELETE
AS
-- JUST CHANGE ##YOUR_TABLE## INTO YOUR OWN TABLENAME TO MAKE IT WORK
DECLARE @SQLSTRING VARCHAR(2000)
DECLARE @SQLColumns VARCHAR(2000)
DECLARE @CUR INTEGER
DECLARE @MAX INTEGER
DECLARE @SQLSTR AS VARCHAR(8000)
DECLARE @CURCOL SYSNAME
DECLARE @COLUMN_NAME SYSNAME
DECLARE @COLUMN_TYPE AS VARCHAR(10)
DECLARE @COLUMN_LENGTH INT
DECLARE @MEMTABLE TABLE
(
ID INT
,COLUMN_NAME SYSNAME
,COLUMN_TYPE VARCHAR(20)
,COLUMN_LENGTH int
)
IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE ID = OBJECT_ID(N'[DBO].[AUDIT_##YOUR_TABLE##]') AND OBJECTPROPERTY(ID,N'ISUSERTABLE') = 1)
BEGIN
-- CREATE A MEMORY TABLE CONTAINING THE FIELDS AND TYPES OF THE TABLE
-- INSERT THE COLUMNAMES AND THE DATATYPES
INSERT @MEMTABLE
(ID,COLUMN_NAME,COLUMN_TYPE)
SELECT row_number() OVER (ORDER BY SYS.ID), SYS.NAME,TYPE_NAME(SYS.XTYPE)
FROM SYSCOLUMNS SYS WHERE SYS.ID = OBJECT_ID('##YOUR_TABLE##')
ORDER BY SYS.COLID
-- SETUP VARIABLES
SET @SQLSTR = ''
SET @CUR=1
SELECT @MAX = ISNULL(MAX(ID),0) FROM @MEMTABLE
-- LOOP EVEY FIELD
WHILE @CUR <= @MAX
-- GET VALUES FROM THE MEMTABLE
SELECT @COLUMN_NAME = COLUMN_NAME,@COLUMN_TYPE = COLUMN_TYPE FROM @MEMTABLE WHERE ID = @CUR
IF @COLUMN_TYPE = 'INT' OR @COLUMN_TYPE = 'BIGINT' OR @COLUMN_TYPE='UNIQUEIDENTIFIER'
-- WE DO WANT TO COPY INT/BIGINT/UNIQUEIDENTIFIER FIELDS BUT IF THEY ARE AN
-- IDENTITY OR A ROWGUIDCOLUMN WE DO NOT WANT TO COPY THAT ATTRIBUTES
SET @SQLSTR = @SQLSTR + ' CAST('+@COLUMN_NAME + ' AS '+@COLUMN_TYPE+') AS [' + @COLUMN_NAME +'] '
ELSE
-- ANOTHER FIELD DO NOTHING JUST COPY IT AS IT IS
SET @SQLSTR = @SQLSTR + ' '+@COLUMN_NAME + ' AS [' + @COLUMN_NAME +'] '
IF @CUR <= @MAX - 1
SET @SQLSTR=@SQLSTR + ','
SET @CUR = @CUR + 1
END
-- ADD THE HIST FIELDS
SET @SQLSTR = @SQLSTR +',CAST('' '' AS CHAR(6)) AS TRG_ACTION,CAST(GETDATE() AS DATETIME) AS TRG_DATE'
-- SET UP THE SELECT FOR CREATING THE HIST TABLE
SET @SQLSTR = 'SELECT TOP 0 ' + @SQLSTR + ' INTO [DBO].[AUDIT_##YOUR_TABLE##] FROM [DBO].[##YOUR_TABLE##]'
EXEC(@SQLSTR)
--SELECT @SQLSTR
--FIND MISSING COLUMNS IN AUDIT TABLE AND STORE THEM IN @MEMTABLE
IF (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '##YOUR_TABLE##'
AND COLUMN_NAME NOT IN (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'AUDIT_##YOUR_TABLE##' )) > 0
DELETE @MEMTABLE
(ID,COLUMN_NAME,COLUMN_TYPE,COLUMN_LENGTH)
SELECT row_number() OVER (ORDER BY SYS.ID),SYS.NAME,TYPE_NAME(SYS.XTYPE),SYS.[LENGTH]
AND SYS.NAME NOT IN (SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'AUDIT_##YOUR_TABLE##' )
SELECT @COLUMN_NAME = COLUMN_NAME,@COLUMN_TYPE = COLUMN_TYPE, @COLUMN_LENGTH = COLUMN_LENGTH FROM @MEMTABLE WHERE ID = @CUR
IF @COLUMN_TYPE = 'varchar' OR @COLUMN_TYPE ='char' OR @COLUMN_TYPE='nvarchar'
SET @SQLSTR = @SQLSTR + @COLUMN_NAME + ' ' + @COLUMN_TYPE + '(' + CAST(@COLUMN_LENGTH AS VARCHAR(10)) + ')'
SET @SQLSTR = @SQLSTR + @COLUMN_NAME + ' ' + @COLUMN_TYPE
SET @SQLSTR = @SQLSTR + ','
--SELECT N'ALTER TABLE AUDIT_##YOUR_TABLE## ADD ' + @SQLSTR
EXEC(N'ALTER TABLE AUDIT_##YOUR_TABLE## ADD ' + @SQLSTR )
--SELECT 'ALTER AUDIT_##YOUR_TABLE## ADD (' + @SQLSTR + ')'
--COPY DELETED RECORDS TO MEMORY TABLE SO IT CAN BE USED WITH DYMANIC QUERY
IF OBJECT_ID('###YOUR_TABLE##_DELETED') IS NOT NULL
DROP TABLE ###YOUR_TABLE##_DELETED
SELECT * INTO ###YOUR_TABLE##_DELETED FROM ##YOUR_TABLE## WHERE TABLEID = (SELECT MAX(TABLEID) FROM ##YOUR_TABLE##)
--GET STRING FOR COLUMNS EXISTING IN BOTH ##YOUR_TABLE## AND AUDIT_##YOUR_TABLE##
SELECT DISTINCT @SQLColumns = STUFF(
(SELECT ',' + COLUMN_NAME FROM
(SELECT DISTINCT COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'AUDIT_##YOUR_TABLE##' AND
COLUMN_NAME IN
(SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '##YOUR_TABLE##') )
AS SC FOR XML PATH('')),1,1,'')
EXEC(N'INSERT INTO [DBO].[AUDIT_##YOUR_TABLE##] (' + @SQLColumns + ',TRG_DATE) SELECT ' + @SQLColumns + ',GETDATE() FROM ###YOUR_TABLE##_DELETED')
In the query I recently submitted,
needs to be changed by:
SELECT * INTO ###YOUR_TABLE##_DELETED FROM DELETED
I was testing :)
I wonder how this performs. It's a lot more database actions, I think, compared to the original code. Especially since you need to check for changes in columns every time the code is triggered.
Thanks for posting your code and comments Jan (and to everyone who commented on this article). I have a similar problem that everyone is facing, but with a slight twist. Here's the scenario:
My company has been using an Ftp program called RoboFtp to drop text data files into a folder. As soon as the files are there, a program utilizing the FileSystemWatcher object then launches an exe to process the files. This process has been working like a charm for the past 5 years or so. However, recently we tried to change the process to take out the RoboFtp program out of the equation. The files now are being dropped by some legacy mainframe programs using their own Ftp program. And since we switched, we have encountered a file access violation issue twice in the past 2 weeks. The odd thing is that this process works most of the time, but fails occasionally.
Does anyone know how to explain this problem?
Max
tnx your solution works :)
Can I hide business object button on top right corner?
if condition1 then
statment1
if condition2 then
statment2
end if
is it a true ? pls?
Heh, thanks. It's a really useful tip.. Mostly I use it to re-align my code in ASP.NET where my HTML tags really get messy.
Yes you can. But you'll have to find the control to disable yourself. What my code does is walk through the tree of controls in the viewer control and disables the ones I recognize. A similar trick needs to be done for the BO button.
This may just be exactly what I'm looking for, but I don't know much about SQL, so let me run this by you for clarification so that I fully understand what this does, and if it's what we need. I've got an application I wrote that manages our site installation data, and that syncs with a central SQL server over the internet whenever a user hits a "Sync" button. (bi directional). One of the features that our field engineers asked for was to have a log of any changes made, and by who made them. Am I correct in understanding that this trigger will copy ANY column updated in your table to a new table? so say for example, I update device serial number, and maybe device description on one item... and then update device location, and device IP for a different device, will it record just that data in the audit table? or doe this copy the whole row? I need something that just logs a date/time someone updated something, and then records old value/new value.
Thanks.
This trigger will simply copy the entire row into an audit table. If you're looking at logging only changed data, then this is not for you.
Elegant in both simplicity and usefulness - thanks for posting this.
I have a winforms application.
When i deploy and run the application, i get error:Report failed to load.
I have the CRRedist2008_X86 on the test machine. What other files do i need to install on the test machine for successfully running the application.
Do i need to install the crystal report runtime on the test machine?
Thanks, really helpful.
I am facing same error as Maran ie. cr working fine on local server but on production side it throws an exception as 'An error has occurred while attempting to load the Crystal Reports runtime.
Please install the appropriate Crystal Reports redistributable (CRRedist*.msi) containing the correct version of the Crystal Reports runtime (x86, x64, or Itanium) required. Please go to www.businessobjects.com/support for more information.'
any clues for this?
As the message already states, you need to install the CR runtime on the production server. You can download the redistributables for this from the business objects web site.
There's no need to write a separate program just to view the service names. Just right click and look at the properties of any service in the Services window (from admin tools) and the service name is right there.
Yep, that's true. But the code was fun to write and is used to show how you can access the information using .Net.
its not working. please try again.
copying and pasting that into the compact framework code produces a not support exception
Very likely, since the code was not written for the compact framework :-)
Micrsoft just does not understand the concept of simplicity. It's 2009 and it still takes 3+ downloads/tools to generate a damn help file(s). what is wrong with them!?
I click on their documentation to using SandCastle and it still doesn't help. It's just ridiculous.
Good Approach, but it takes almost 1 second you can sleep that thread as well e.g Thread.Sleep(1000)
Usman Javed
I have tried all of the suggestions that I have found on this topic, and I have had my web provider install the CR runtime on the server, but I still get the error message. Everything works fine on my computer, but the error occurs when I try it on the server.
Has anyone found any other tricks to solve this problem?
This is nioe just one line of code...i was looking at other articles which shows to read the registry and edit ...which is risky...
thx, always appreciate such timesaving snippets!
How about doing this with an additional SectionGroup then Section. How will this be implemented
Thanks Very Much I was a bit bit rusty about it but thanks a lot it has helped
And what about writing back the file ?
Thanks it is works.
That can be done using the Jet engine as well. But you'd have to look at the documentation for that. Haven't implemented that.
Me sirvió de mucho, Gracias
Thanks for the code.
It was helpful.
i created a windows project..but when i need to install it in the client computer i need to intsall the visula studio project setup and crystal report 9.0(manually)...but i need CR 9.0 to get installed with visula studio project setup
You will need to add the merge modules to the setup.
Brilliant, work around. Saved me a lot of time.
How i have installed both 2.0 and 3.5 . how i can copy crystal reports dlls for version 2.0
3 years after you wrote this, it's STILL helpful. Thanks.
Standard Label class has a property named AutoEllipsis which do the same
Thank you for the time to post this article.
I am new to Sql. I tried using the above code and made the changes for the update section as I want to record the updated fields. I am not able to insert the code that you provided at the end of the main code. I am getting errors related to columns not found. StatusID, STATUS, Alerted, etc...
Thanks again
I know, but it was an old version of ASP.Net for which we did this.
He should also have added an index for each possible combination of columns.
Thank you so much, this has help me a lot.
Hi There,
Can I reuse the parameters when the refresh button is clicked? Please advice,
Thank you
I need to display exact no of pages instead of 1+. Can anybody help me?
@Chris: yes that should be possible.
@Prajakta: Problem is that CR only knows the exact number of pages once it has rendered all pages. So the only option is to do a navigate to the last page and then back to the first. Which could be time consuming.
Your created event handler is doing way too much, and may cause multiple file creations to be missed. Have the created spawn off a new thread to do the rest of the processing so that the event handler returns almost immediately.
Never really noticed a missing file creation to be quite honest, but handling the code in a seperate thread is a useful addition.
Thank you sooooooooooooo much.. its working fine for me.. thanx :)
I tend to hand off processing to the thread pool as andy suggests. I think the created events get buffered and a mixture of a high volume of events and a long processing time migh t result in events getting lost.
Thanks for the links. They are really helpful for the learners.
Thanks for this great article!
I think a small but very important switch is missing in the batch command:
WSDL /language:CS NAME.WSDL
generates a client by default.
To generate a dummy WS, the /server switch has to be used:
WSDL /language:CS /server GeneratePDFService.wsdl
Do you agree?
Thanks a lot, this worked great as is.
I have VS2005 installed and default crystal reports. I have developed a windows applications project using crystal reports.
Now I uninstalled default crystal reports and installed CR9.0. But when I open my project and add new crystal report,it is still old one. How should I configure in VS to use new CR 9.0? any idea will be appreciated.
I coundnt agree more, what a useless piece of crap!!
Creating MSDN like documentation of your C# project
Regarding:
veljkoz said:
-- A few people complained of not being able to download from the link given. A quick Google search for "Crystal Reports Basic for Visual Studio .NET 2008" msi pointed to the new address - for those interested:
resources.businessobjects.com/.../runtime.asp