Vbscript
MSSQL Search & Add Query Using Vbscript
by Installer on Feb.23, 2010, under MSSql Query
With This VBScript you can search into a field for Value and add it (if you want).
If you use the following script you Dont need to open ”SQL Server Managment Studio”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | Do Searchdata = InputBox("Please enter the Value", "Input") Loop Until Searchdata = "" cnstring = "Provider=SQLOLEDB.1;Password=PASSWORD;Persist Security Info=True;User ID=USERNAME;Initial Catalog=USERNAME;Data Source=192.168.2.2;" cmdtext = "SELECT * FROM DATABASE where FIELD_NAME = "& Searchdata &"" Set cn = CreateObject("adodb.connection") Set cmd = CreateObject("adodb.command") cn.connectionstring = cnstring cn.Open cmd.activeconnection = cn cmd.commandtext = cmdtext Set rs = CreateObject("adodb.recordset") rs.cursortype = 3 rs.locktype = 3 rs.Open(cmd) While Not rs.EOF And Not rs.BOF 'WScript.Echo rs.Fields.Item("FIELD_NAME").Value Data = rs.Fields.Item("FIELD_NAME").Value 'WScript.Echo Data rs.MoveNext Wend rs.Close cn.Close If Data = "" Then WScript.Echo "Ta Dedomena den Yparxoun sti Vasi" answer=MsgBox ("Do you want to Add the "& Data &" ", 36, "ADD THE VALUE ") If answer = 6 Then cnstring = "Provider=SQLOLEDB.1;Password=PASSWORD;Persist Security Info=True;User ID=USERNAME;Initial Catalog=USERNAME;Data Source=192.168.2.2;" cmdtext = "INSERT INTO DATABASE (FIELD_NAME) VALUES (" & Data & ")" Set cn = CreateObject("adodb.connection") Set cmd = CreateObject("adodb.command") cn.connectionstring = cnstring cn.Open cmd.activeconnection = cn cmd.commandtext = cmdtext cmd.Execute cn.Close WScript.Quit Else WScript.echo "NO" WScript.Quit End If Else WScript.Echo "Ta Dedomena Yparxoun Sti Vasi" End If |
Related posts
Find Windows Install Date
by Installer on Jan.29, 2010, under Windows
The Script
1 2 3 4 5 6 7 8 9 10 11 12 | Set OSSet = GetObject("winmgmts://." _ & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem") For Each OS In OSSet wscript.echo FormatUTime(OS.InstallDate) Next '----------------------------------------- 'Format "Universal Time" to DD.MM.YY HH:MM '----------------------------------------- Function FormatUTime (S) FormatUTime = Mid(S, 7, 2) & "." & Mid(S, 5, 2) & "." & Mid(S, 3, 2) _ & " " & Mid (S, 9, 2) & ":" & Mid(S, 11, 2) & " " End Function |
Related posts
Create Shortcut at your Desktop
by Installer on Jan.25, 2010, under Windows
This vbscript create automatically a shortcut at your Desktop
1 2 3 4 5 | set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Install.gr") oUrlLink.TargetPath = "http://www.install.gr" oUrlLink.Save |
Related posts
Find windows Install Date
by Installer on Jan.22, 2010, under Windows
This Script find windows Install Date – Time
Notes:
Windows XP: Test Completed Success
Windows 2003: Test Completed Success
windows 2008: Test Completed Success
Windows Vista: Test Completed Success
Windows 7 : Test Completed Success
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ' * VBScript Find Windows Install Date ' * Version: 1.0 ' * ' * Enjoy! Set OSSet = GetObject("winmgmts://." _ & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem") For Each OS In OSSet wscript.echo FormatUTime(OS.InstallDate) Next '----------------------------------------- 'Format "Universal Time" to DD.MM.YY HH:MM '----------------------------------------- Function FormatUTime (S) FormatUTime = Mid(S, 7, 2) & "." & Mid(S, 5, 2) & "." & Mid(S, 3, 2) _ & " " & Mid (S, 9, 2) & ":" & Mid(S, 11, 2) & " " End Function |
Related posts
Easy Internet Explorer Proxy Changer
by Installer on Jan.22, 2010, under Internet Explorer
Notes:Windows XP : Test Completed Success
Windows 7 : Not Working
The Script
(continue reading…)
Related posts
Export PST from Microsoft Outlook 2003/2007
by Installer on Jan.22, 2010, under Microsoft Outlook
Notes:Export Folder: “c:\Outlook”Outlook 2007: Test Completed Success
Outlook 2003: Not Tested yet