Thanks for your reply, However my doubt still exists.
I have pasted the sample code here. In thse lines of code, When I convert
the datatype to string, the currency data type gets converted to decimal, How
will I identify the currency datatype
If ds.Tables(0).Columns(k).DataType.ToString =
"System.DateTime" Then
sVal = Format(ds.Tables(0).Rows(j).Item(k),
"mm/dd/yy")
objExcel.Cells(RowCounter, ColCounter) = sVal
'* Be default the money datatype and numeric data type both are identified
as decimal
ElseIf ds.Tables(0).Columns(k).DataType.ToString =
"System.Decimal" Then
sVal = ds.Tables(0).Rows(j).Item(k)
objExcel.Cells(RowCounter, ColCounter) = sVal
objExcel.Range(objExcel.Cells(RowCounter,
ColCounter), objExcel.Cells(RowCounter, ColCounter)).Select()
'** I want to execute the below code only if the datatype is money and not
for decimal. How will I
'** incorporate the same.
objExcel.Selection.NumberFormat = "$#,##0.00"
"Cor Ligthert" wrote:
Sri,
You can use the overloaded version of ToString in combination with this
http://msdn.microsoft.com/library/de...classtopic.asp
I hope this helps,
Cor