Hi Friends
Friday, July 13, 2012
Search column name in tables in SQL Database
select
sc
.
name
as
col_name
,
so
.
name
as
table_name
from
syscolumns sc
inner
join
sysobjects so
on
so
.
id
=
sc
.
id
where
sc
.
name
like
'column_name'
and
so
.
xtype
=
'U'
Thursday, July 5, 2012
To convert any date filed with time to date without time like 1-Jan-2012 00:00:00.00
update TableName set Datefield=cast(convert(varchar,datefield,106) as datetime)
Tuesday, July 3, 2012
Save VsFlexGrid data to excel
Private
Sub
FlexToExcel
(
)
Dim
xlObject
As
Excel.Application
Dim
xlWB
As
Excel.Workbook
Set
xlObject =
New
Excel.Application
'This Adds a new woorkbook, you could open the workbook from file also
Set
xlWB = xlObject.Workbooks.Add
Clipboard.Clear
'Clear the Clipboard
With
MSFlexGrid1
'Select Full Contents (You could also select partial content)
.Col =
0
'From first column
.Row =
0
'From first Row (header)
.ColSel = .Cols -
1
'Select all columns
.RowSel = .Rows -
1
'Select all rows
Clipboard.SetText .Clip
'Send to Clipboard
End
With
With
xlObject.ActiveWorkbook.ActiveSheet
.Range
(
"A1"
)
.Select
'Select Cell A1 (will paste from here, to different cells)
.Paste
'Paste clipboard contents
End
With
' This makes Excel visible
xlObject.Visible =
True
End
Sub
Monday, July 2, 2012
Binding Combobox at run time without using database connection via Dictionery Objec
Dim objDict As New Dictionary(Of String, String)
objDict.Add("1", "Value 1")
objDict.Add("2", "Value 2")
ComboBox1.DataSource = New BindingSource(objDict, Nothing)
ComboBox1.DisplayMember = "Value"
ComboBox1.ValueMember = "Key"
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)