DELETE FROM table WHERE col1 IN (
SELECT id FROM table GROUP BY id HAVING ( COUNT(col1) > 1 )
)
Friday, 20 June 2014
Delete Duplicates Row in SQL SERVER
Tuesday, 10 June 2014
Shatrughana Kumar Gupta: DateTime Formating Using VB.NET
Shatrughana Kumar Gupta: DateTime Formating Using VB.NET: Dim str As String = "2014-06-10 17:41:38.760" Dim str1 As Date = Convert.ToDateTime(str) Dim strres As String ...
DateTime Formating Using VB.NET
Dim str As String = "2014-06-10 17:41:38.760"
Dim str1 As Date = Convert.ToDateTime(str)
Dim strres As String = Format(str1, "yyyy-MMM-dd hh:mm:ss")
result : 2014-Jun-10 05:41:38
Dim str1 As Date = Convert.ToDateTime(str)
Dim strres As String = Format(str1, "yyyy-MMM-dd hh:mm:ss")
result : 2014-Jun-10 05:41:38
Friday, 6 June 2014
Date Time Format of date
CONVERT(VARCHAR(19),GETDATE())
CONVERT(VARCHAR(10),GETDATE(),10)
CONVERT(VARCHAR(10),GETDATE(),110)
CONVERT(VARCHAR(11),GETDATE(),6)
CONVERT(VARCHAR(11),GETDATE(),106)
CONVERT(VARCHAR(24),GETDATE(),113)
===========================================
return:
Nov 04 2011 11:45 PM
11-04-11
11-04-2011
04 Nov 11
04 Nov 2011
04 Nov 2011 11:45:34:243
For particular column then:
select convert(varchar(10),enter_date,110),college_name_removesc from affidavitdata
''enter_date is column
CONVERT(VARCHAR(10),GETDATE(),10)
CONVERT(VARCHAR(10),GETDATE(),110)
CONVERT(VARCHAR(11),GETDATE(),6)
CONVERT(VARCHAR(11),GETDATE(),106)
CONVERT(VARCHAR(24),GETDATE(),113)
===========================================
return:
Nov 04 2011 11:45 PM
11-04-11
11-04-2011
04 Nov 11
04 Nov 2011
04 Nov 2011 11:45:34:243
For particular column then:
select convert(varchar(10),enter_date,110),college_name_removesc from affidavitdata
''enter_date is column
Thursday, 5 June 2014
Remove Duplicates from String
Function rduplicatestring(ByVal str As String) As String
rduplicatestring = ""
Dim myarr() As String = Split(str, Space(1))
myarr = myarr.Distinct().ToArray
myarr = myarr.DefaultIfEmpty().ToArray
rduplicatestring = Replace(Join(myarr, Space(1)), Space(2), Space(1))
Return rduplicatestring
End Function
rduplicatestring = ""
Dim myarr() As String = Split(str, Space(1))
myarr = myarr.Distinct().ToArray
myarr = myarr.DefaultIfEmpty().ToArray
rduplicatestring = Replace(Join(myarr, Space(1)), Space(2), Space(1))
Return rduplicatestring
End Function
Alphabetical Sorting Of any String Using vb.net
Function alphabetsorting(ByVal str As String) As String
alphabetsorting = ""
Dim arrayLetters As Array = str.ToCharArray()
Array.Sort(arrayLetters)
For i As Integer = 0 To arrayLetters.Length - 1
If alphabetsorting = "" Then
alphabetsorting = arrayLetters(i)
Else
alphabetsorting = alphabetsorting & arrayLetters(i)
End If
Next
Return alphabetsorting
End Function
alphabetsorting = ""
Dim arrayLetters As Array = str.ToCharArray()
Array.Sort(arrayLetters)
For i As Integer = 0 To arrayLetters.Length - 1
If alphabetsorting = "" Then
alphabetsorting = arrayLetters(i)
Else
alphabetsorting = alphabetsorting & arrayLetters(i)
End If
Next
Return alphabetsorting
End Function
Wednesday, 4 June 2014
Add Images in Listbox and copy from one directory to another directory using vb.net
Dim path1 As String = "D:\scan"
My.Computer.FileSystem.CreateDirectory(path1)
Dim info As New DirectoryInfo(path1)
If (info.Exists) Then
Dim file As FileInfo = Nothing
file = info.GetFiles.Last
If (file.Extension = ".png") Then
ListBox1.Items.Add(file.FullName)
End If
PictureBox1.ImageLocation = fileName
i = 0
====================================================
For index As Integer = 0 To ListBox1.Items.Count - 1
Dim src1 As String = ListBox1.Items(index.ToString())
If Directory.Exists("D:MyScan\") Then
Dim f1 As String = Path.GetFileName(src1)
dest1 = Convert.ToString("D:\MyScan\") & f1
File.Copy(src1, dest1)
PictureBox1.Image = Nothing
Else
Directory.CreateDirectory("D:\MyScan\")
Dim f1 As String = Path.GetFileName(src1)
dest1 = Convert.ToString("D:\MyScan\") & f1
File.Copy(src1, dest1)
PictureBox1.Image = Nothing
End If
My.Computer.FileSystem.CreateDirectory(path1)
Dim info As New DirectoryInfo(path1)
If (info.Exists) Then
Dim file As FileInfo = Nothing
file = info.GetFiles.Last
If (file.Extension = ".png") Then
ListBox1.Items.Add(file.FullName)
End If
PictureBox1.ImageLocation = fileName
i = 0
====================================================
For index As Integer = 0 To ListBox1.Items.Count - 1
Dim src1 As String = ListBox1.Items(index.ToString())
If Directory.Exists("D:MyScan\") Then
Dim f1 As String = Path.GetFileName(src1)
dest1 = Convert.ToString("D:\MyScan\") & f1
File.Copy(src1, dest1)
PictureBox1.Image = Nothing
Else
Directory.CreateDirectory("D:\MyScan\")
Dim f1 As String = Path.GetFileName(src1)
dest1 = Convert.ToString("D:\MyScan\") & f1
File.Copy(src1, dest1)
PictureBox1.Image = Nothing
End If
Stop Sorting In Data Grid View using vb.net
Private Sub gridshot_ColumnAdded(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewColumnEventArgs) Handles gridshot.ColumnAdded
gridshot.Columns.Item(e.Column.Index).SortMode = DataGridViewColumnSortMode.NotSortable
End Sub
gridshot.Columns.Item(e.Column.Index).SortMode = DataGridViewColumnSortMode.NotSortable
End Sub
How to count files in Specific Folder using vb.net
Imports System.IO
=====================
Public Class Form2
Dim Files() As String
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim path1 As String = "D:\scan"
Dim dr As New DirectoryInfo(path1)
If dr.Exists Then
Dim res As Integer = FileCount(path1)
For i As Integer = 0 To res - 1
Dim st As String = (Replace(Files(i), path1 & "\", ""))
Dim re As String = Replace(st, ".jpg", "")
Next
End If
End Sub
Public Function FileCount(ByVal FolderName As String) As Integer
Files = IO.Directory.GetFiles(FolderName)
Return Files.Length
End Function
End Class
rs return:1,2,3
=====================
Public Class Form2
Dim Files() As String
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim path1 As String = "D:\scan"
Dim dr As New DirectoryInfo(path1)
If dr.Exists Then
Dim res As Integer = FileCount(path1)
For i As Integer = 0 To res - 1
Dim st As String = (Replace(Files(i), path1 & "\", ""))
Dim re As String = Replace(st, ".jpg", "")
Next
End If
End Sub
Public Function FileCount(ByVal FolderName As String) As Integer
Files = IO.Directory.GetFiles(FolderName)
Return Files.Length
End Function
End Class
rs return:1,2,3
Subscribe to:
Posts (Atom)
Followers
Blog Archive
-
▼
2014
(28)
-
▼
June
(9)
- Delete Duplicates Row in SQL SERVER
- Shatrughana Kumar Gupta: DateTime Formating Using ...
- DateTime Formating Using VB.NET
- Date Time Format of date
- Remove Duplicates from String
- Alphabetical Sorting Of any String Using vb.net
- Add Images in Listbox and copy from one directory ...
- Stop Sorting In Data Grid View using vb.net
- How to count files in Specific Folder using vb.net
-
▼
June
(9)