Inherits System.Windows.Forms.Form
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As SqlDataReader
myConnection = New SqlConnection("server=<server_name>;uid=<username>;pwd=<password>")
Try
myConnection.Open()
myCommand = New SqlCommand("Select * from Mal", myConnection)
dr = myCommand.ExecuteReader()
Do
While dr.Read()
MessageBox.Show("ID:" & dr(0).ToString())
End While
Loop While dr.NextResult
dr.Close()
myConnection.Close()
Catch ex As Exception
End Try
End Sub
Wednesday, February 2, 2011
Winzip commandline
Include wzunzip.exe in debug folder
wzunzip -s<zip password> D:\0322090029.zip \\c01\d$\v\VSample1\0903261001\VSamples\Generic\Samples 0903261001\VSamples\Generic\Samples\00167043523009bce27d5a85a3716314
wzunzip -s<zip password> D:\0322090029.zip \\c01\d$\v\VSample1\0903261001\VSamples\Generic\Samples 0903261001\VSamples\Generic\Samples\00167043523009bce27d5a85a3716314
Convert CSV file to Excel File
Public Sub ConvertCSVtoXL(ByVal strCSVPath As String)
Try
Dim xlsApp = New Excel.Application
Dim xlsBook = xlsApp.Workbooks.Open(Filename:=strCSVPath, UpdateLinks:=False, ReadOnly:=False)
xlsBook.SaveAs(FileName:=C:\Reject", FileFormat:=Excel.XlFileFormat.xlExcel9795)
xlsApp.quit()
Catch ex As Exception
System.Console.WriteLine("Converting to Excel File Error: " + ex.Message)
End Try
End Sub
Try
Dim xlsApp = New Excel.Application
Dim xlsBook = xlsApp.Workbooks.Open(Filename:=strCSVPath, UpdateLinks:=False, ReadOnly:=False)
xlsBook.SaveAs(FileName:=C:\Reject", FileFormat:=Excel.XlFileFormat.xlExcel9795)
xlsApp.quit()
Catch ex As Exception
System.Console.WriteLine("Converting to Excel File Error: " + ex.Message)
End Try
End Sub
Command Line Arguments
Set Application Type to Console Application
'[CONS withspyware] TopXPrepare.exe - cons -spy
Try
'----Parsing the Commandline to tag if BETA of CONS
Dim args() As String = System.Environment.GetCommandLineArgs()
For i As Integer = 0 To args.Length - 1
If i = 1 Then
If args(i) = "-beta"
Parameter = "BETA"
If args(i + 1) = "-spy"
SParameter = "SPY"
ElseIf args(i + 1) = "-nospy"
SParameter = "NOSPY"
End If
ElseIf args(i) = "-cons"
Parameter = "CONS"
If args(i + 1) = "-spy"
SParameter = "SPY"
ElseIf args(i + 1) = "-nospy"
SParameter = "NOSPY"
End If
Else
End If
End If
Next
Console.ReadKey()
Catch ex As Exception
End Try
'[CONS withspyware] TopXPrepare.exe - cons -spy
Try
'----Parsing the Commandline to tag if BETA of CONS
Dim args() As String = System.Environment.GetCommandLineArgs()
For i As Integer = 0 To args.Length - 1
If i = 1 Then
If args(i) = "-beta"
Parameter = "BETA"
If args(i + 1) = "-spy"
SParameter = "SPY"
ElseIf args(i + 1) = "-nospy"
SParameter = "NOSPY"
End If
ElseIf args(i) = "-cons"
Parameter = "CONS"
If args(i + 1) = "-spy"
SParameter = "SPY"
ElseIf args(i + 1) = "-nospy"
SParameter = "NOSPY"
End If
Else
End If
End If
Next
Console.ReadKey()
Catch ex As Exception
End Try
Traverse Directory Files and Get Files
Dim
filename, filename2 As FileInfoDim myDirectoryInfo As DirectoryInfo
'----location where the pattern sources are being stored
myDirectoryInfo = New DirectoryInfo(C:\Duplicates")
Dim myDir As IO.DirectoryInfo
Dim filesInfo() As FileInfo
Dim fileInfo As FileInfo
Try
filesInfo = myDirectoryInfo.GetFiles()
For Each fileInfo In filesInfo
'Filenames will have the files under a directory
Filenames = fileInfo.FullName
Next
Try
myDirectoryInfos = myDirectoryInfo.GetDirectories()
For Each myDir In myDirectoryInfos
'del_folder will have the files under a directory
del_folder = (myDir.FullName)
Next
Catch ex As Exception
End Try
filename, filename2 As FileInfoDim myDirectoryInfo As DirectoryInfo
'----location where the pattern sources are being stored
myDirectoryInfo = New DirectoryInfo(C:\Duplicates")
Dim myDir As IO.DirectoryInfo
Dim filesInfo() As FileInfo
Dim fileInfo As FileInfo
Try
filesInfo = myDirectoryInfo.GetFiles()
For Each fileInfo In filesInfo
'Filenames will have the files under a directory
Filenames = fileInfo.FullName
Next
Try
myDirectoryInfos = myDirectoryInfo.GetDirectories()
For Each myDir In myDirectoryInfos
'del_folder will have the files under a directory
del_folder = (myDir.FullName)
Next
Catch ex As Exception
End Try
Subscribe to:
Comments (Atom)
