Saturday, October 30, 2010

Incorrect Syntax near % sql parameter (C#)

When writing sql statements in your business logic layer, you often want to append % which is a literal in your query. An example would be like this:
string query = "Select * from Patient where LastName like '" + "@family" + " %'";
However, this would give you an error, since the @family parameter is inside the tick marks that makes it a literal, but the % sign should be inside the tick marks. So, the correct sql syntax would be this way:
string query = "Select * from Patient where LastName like (@family + '%')";

Source: VBForums Link

Wednesday, October 27, 2010

Set top property of text object and field object of crystal reports during runtime (Crystal Reports.NET)

I have encountered a scenario when creating crystal reports for a specific customer. In my reports, I have four controls.
1. Comments (Text Object) and Comments (Field object )w/ top properties of 3465.
2. Recommendations (Text Object) and Recommendations (Field object ) w/ top properties of 4505.

Here's what i need to do.
if ((recommendations field object != null) && (comments field object == null)))  
2:     If true, set top properties of Recommendations Text   
3:     object and commendations Field object to 3465.  

Solution in VBForums.

Linux, Free BSD, Oracle articles

Here's a site from a friend of mine containing series of topics on Linux and open source softwares.

"No description found" error message pops-up when creating a SQL Server maintenance plan in SQL Server 2005

If there are instances that you failed to create maintenance plan (backup plan) in MS SQL due to the error specified above, the solution would be to reregister MSXML.

Unable to Print Reports using Samsung Printers and Crystal Reports (ASP.NET)

I encountered lately an error when printing a report from a deployed website. I installed correctly the printer software/drivers. The printer used was Samsung.
In Control Panel (Printers and Faxes), add user account to the default printer.

The Official Microsoft ASP.NET Site (Main ASP.NET Website)