Shivaprakash HM

…………………..Site for my technical reference

Insert Null value in Access db

Posted by urshiva on November 25, 2009

strSql = “INSERT INTO tbl (clmn1,clmn2) Values(1,null)”

 

Posted in General | Leave a Comment »

.net Debuggers

Posted by urshiva on July 7, 2009

1. CorDBG – command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch. it resides in “C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\

2. DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. it resides in “C:\Program Files\Microsoft.NET\SDK\v2.0\GuiDebug”

more information :  http://blogs.msdn.com/noahc/archive/2006/01/04/509450.aspx

Posted in General | Leave a Comment »

SQL: Rename table

Posted by urshiva on June 30, 2009

here is the syntax for renaming table in sql server
EXEC sp_rename ‘old_name_of_table’, ‘new_name_of_table ‘

Posted in SQL Server 2005 | Leave a Comment »

How to configure SQL Server 2005 to allow remote connections

Posted by urshiva on June 29, 2009

Posted in SQL Server 2005 | Leave a Comment »

Distinct rows from Datatable

Posted by urshiva on June 11, 2009

we can get distinct rows from a datatable by following way…

myDataTable.DefaultView.ToTable(True, “myDistinctColumnName”)

First parameter takes boolean value for mentioning we need Distinct or Not.

passing True is for Distinct records.

Posted in General | Tagged: | Leave a Comment »

iReport: Group Hiding and Displaying

Posted by urshiva on May 11, 2009

To hide group depending on field value,

you can do this by setting Print when expression property of particular Group band.

for ex:

Print when expression: ($F{my_field_codice} != null) ? Boolean.TRUE : Boolean.FALSE

above statement hides the group when you got the value null for $F{my_field_codice}.

else it displays the group.

Posted in iReport | Tagged: , | 3 Comments »

PostgreSql: Getting Date in Different Format and group by month

Posted by urshiva on April 30, 2009

Select  to_char(date_inserted, ‘YYYYMM’) as year_month,

to_char(date_inserted, ‘YYYY’) as year_string,

to_char(date_inserted, ‘month’) as month_string

from myTable

group by year_month

order by year_month;

In the above example,

  • year_month value is displayed as 200804, here 2008 is year and 04 is month.
  • year_string value is displayed as 2008, its a year.
  • month_string value is displayed as april, its the month in date (04 – april month)

Posted in Postgre SQL, Uncategorized | 1 Comment »

iReport: Applying Condition depending on the parameter value passed

Posted by urshiva on April 30, 2009

i had the problem

like

i want to keep the where condition depending on the value of parameter is pass.

i tried different things, and final got through with following solution.

select * from deptartment

where

(CASE WHEN $P{param_dept_codice} = -1

THEN true

ELSE dept_codice = $P{param_dept_codice}

END)

above query displays all the records from deptartment table, if you pass the param_dept_codice as -1 .

if you pass some exact deptartment id other than -1, then it will return only those records that satisfies the condition.

Note: i gave -1 for checking because i m sure that i will not have any record with that dept_codice.


Posted in Postgre SQL, iReport | 5 Comments »

iReport: Condition Expression ?:

Posted by urshiva on April 20, 2009

in ireports we can write condional expression depending on the parameter passed.

here is the example.

$P{param_codice}.equals( new java.lang.Long(-1) ) ? “” : $F{field_descrizione}

Posted in iReport | Leave a Comment »

iReport: Displaying current date and time

Posted by urshiva on April 17, 2009

To display current date and time,

you can add a Text field component to design interface.

set the following properties:

  • Expression class :  java.util.Date
  • Text Field Expression :  new Date()
  • Pattern: dd MMMMM yyyy h.mm a

Properties for datetime displaying

Posted in Uncategorized | Leave a Comment »