Monday, March 26, 2018

VS2013 Crystal Report From SP Parameter not Updated from Verify Database.

After an hour i resolved this issue.

I just altered my SP and Pass default Null Value to my new parameter that was not showing in Crystal Report after verify database and I made sure that my SP execute without any error in SQL.

After that Crystal Report pick my new SP Parameter :).

I revert my SP as old



Thursday, March 12, 2015

To change the image dynamically in crystal reports

If you are using Crystal Reports XI or later you can do this programatically using the 'Graphic Location' conditional formula.

To do this, perform the following steps:

1. Open the report in the Crystal Reports Designer.

2. Create a formula called "Location" that contains a temporary path string to an image file. For example, "C:\Images\Image1.jpg".

3. Right-click the image on the report and click 'Format Graphic'. The 'Format Editor' dialog box appears.

4. In the 'Picture' tab, click the 'Graphic Location' conditional formula button. The Format Formula Editor appears.

5. Call the "Location" formula from this conditional formula.

6. Save changes to the report.

7. In your application, you can now change the location of the image file at run time, by modifying the text in the "Location" formula programmatically using the following code:

myReport.DataDefinition.FormulaFields["Location"].Text = "'" + "C:\Images\Image2.jpg"+ "'"


You can now view the image successfully when previewing your report in the application.

Monday, November 10, 2014

SQL: Adding Business Days like DATEADD

ALTER FUNCTION [dbo].[BusDaysDateAdd]
(
   @FromDate datetime,
   @DaysToAdd int
)
RETURNS datetime
AS
BEGIN
   DECLARE @Result datetime

   SET @Result = DATEADD(day, (@DaysToAdd % 5) + CASE ((@@DATEFIRST + DATEPART(weekday, @FromDate) + (@DaysToAdd % 5)) % 7)
                                                 WHEN 0 THEN 2
                                                 WHEN 1 THEN 1
                                                 ELSE 0 END, DATEADD(week, (@DaysToAdd / 5), @FromDate))

   RETURN @Result
END

From
http://www.fostersolutions.com/adding-business-days-like-dateadd/

Friday, October 3, 2014

MS SQL Get only date from datetime column

SELECT convert(varchar, getdate(), 100) – mon dd yyyy hh:mmAM (or PM)
                                        – Oct  2 2008 11:01AM          
SELECT convert(varchar, getdate(), 101) – mm/dd/yyyy 10/02/2008                  
SELECT convert(varchar, getdate(), 102) – yyyy.mm.dd – 2008.10.02           
SELECT convert(varchar, getdate(), 103) – dd/mm/yyyy
SELECT convert(varchar, getdate(), 104) – dd.mm.yyyy
SELECT convert(varchar, getdate(), 105) – dd-mm-yyyy
SELECT convert(varchar, getdate(), 106) – dd mon yyyy
SELECT convert(varchar, getdate(), 107) – mon dd, yyyy
SELECT convert(varchar, getdate(), 108) – hh:mm:ss
SELECT convert(varchar, getdate(), 109) – mon dd yyyy hh:mm:ss:mmmAM (or PM)
                                        – Oct  2 2008 11:02:44:013AM   
SELECT convert(varchar, getdate(), 110) – mm-dd-yyyy
SELECT convert(varchar, getdate(), 111) – yyyy/mm/dd
SELECT convert(varchar, getdate(), 112) – yyyymmdd
SELECT convert(varchar, getdate(), 113) – dd mon yyyy hh:mm:ss:mmm
                                        – 02 Oct 2008 11:02:07:577     
SELECT convert(varchar, getdate(), 114) – hh:mm:ss:mmm(24h)
SELECT convert(varchar, getdate(), 120) – yyyy-mm-dd hh:mm:ss(24h)
SELECT convert(varchar, getdate(), 121) – yyyy-mm-dd hh:mm:ss.mmm
SELECT convert(varchar, getdate(), 126) – yyyy-mm-ddThh:mm:ss.mmm

Saturday, September 20, 2014

How to programatically set an item in UltraComboEditor



UltraComboEditor1.DataSource = datatable1;

UltraComboEditor1.DisplayMember = "Caption";
UltraComboEditor1.ValueMember = "Values";

you can set value / selected value by below code.
UltraComboEditor.value = 1 // whatever in value member.


If you want to select Value from display member than you can use below code example.

UltraComboEditor.SelectedIndex = UltraComboEditor.FindString("DisplayValue"); // whatever in display member.



Friday, December 7, 2012

How to calculate age in Years,Months and Days crystal report form date of birth



Here DOB is Date of Birth.

Returns Year = DateDiff('yyyy',{DOB},CurrentDate())

Returns Months = DateDiff('m',{DOB},CurrentDate()) - (DateDiff('yyyy',{DOB},CurrentDate()) *12)

Returns Days =
DateDiff('d',{DOB},CurrentDate()) - ( (DateDiff('m',{DOB},CurrentDate()) / 12) * 365.25  )

Wednesday, October 10, 2012

ZXing QR barcode C# Example


BarcodeWriter BW = new BarcodeWriter();
BW.Format = BarcodeFormat.QR_CODE;
var bitmap =BW.Write("This is Bar Code Text");