If e.Row.Cells(7).Text = " " Then
rbl.Visible = False
Else
rbl.Visible = True
End If
Tuesday, February 16, 2010
Thursday, January 14, 2010
[MSSQL] Format Time hh:mm:ss
Format the date to get time in 24 hours format.
select convert(varchar,getdate(),108)
select convert(varchar,getdate(),108)
[.Net] Vertical column to horizontal column
declare @columns1 VARCHAR(max)
select
@columns1=coalesce(@columns1 + ', ', '') + ('tbl1.' + cast(tA1.column_name AS varchar(100)))
from (
select * from table_field_name
where table_name='table1'
) as tA1
inner join
(select table_name, column_name from (
select * from table_field_name
where table_name='table2'
) as ta) tA2
on tA2.column_name=tA1.column_name
select
@columns1=coalesce(@columns1 + ', ', '') + ('tbl1.' + cast(tA1.column_name AS varchar(100)))
from (
select * from table_field_name
where table_name='table1'
) as tA1
inner join
(select table_name, column_name from (
select * from table_field_name
where table_name='table2'
) as ta) tA2
on tA2.column_name=tA1.column_name
Thursday, December 24, 2009
[MYSQL] Get All The Primary Keys Field Names
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'database'
AND TABLE_NAME = 'table'
AND COLUMN_KEY = 'PRI'
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'database'
AND TABLE_NAME = 'table'
AND COLUMN_KEY = 'PRI'
Tuesday, December 22, 2009
Monday, December 21, 2009
[.NET] Dataset to Excel, It is very simple!
After hours of Googling finally a very simple yet effective way to convert Dataset into Excel file.
Public Sub dataset2Excel(ByVal sqlStr As String)
'excel file path
Dim excelPath As String = ""
excelPath = Server.MapPath("").Replace("\", "") & "\\Sheet1.xls"
'convertion to string
ds = objdb.ExeQuery(sqlStr, "NICEPMData")
Dim grid As New System.Web.UI.WebControls.DataGrid()
grid.HeaderStyle.Font.Bold = True
grid.DataSource = ds
grid.DataBind()
Dim sw As New StreamWriter(excelPath)
Dim hw As New System.Web.UI.HtmlTextWriter(sw)
grid.RenderControl(hw)
End Sub
Cheers!!
Public Sub dataset2Excel(ByVal sqlStr As String)
'excel file path
Dim excelPath As String = ""
excelPath = Server.MapPath("
'convertion to string
ds = objdb.ExeQuery(sqlStr, "NICEPMData")
Dim grid As New System.Web.UI.WebControls.DataGrid()
grid.HeaderStyle.Font.Bold = True
grid.DataSource = ds
grid.DataBind()
Dim sw As New StreamWriter(excelPath)
Dim hw As New System.Web.UI.HtmlTextWriter(sw)
grid.RenderControl(hw)
End Sub
Cheers!!
Sunday, December 20, 2009
[.NET] How To Create an Excel Macro by Using Automation from Visual Basic .NET
Add COM references:
Microsoft Excel <8.0> Object Library, (optional)
Microsoft Office <8.0> Object Library, and
Microsoft Visual Basic for Applications Extensibility Library
NOTE: version must be the same
Please refer to http://support.microsoft.com/kb/303871
Microsoft Excel <8.0> Object Library, (optional)
Microsoft Office <8.0> Object Library, and
Microsoft Visual Basic for Applications Extensibility Library
NOTE: version must be the same
Please refer to http://support.microsoft.com/kb/303871
Subscribe to:
Posts (Atom)