VBScript vupros
0 отговора
49 прегледа
VBScript vupros
Niakoi da znae kakuv script se izpolzuva za populvane na databaza s VBscript.
Znachi iformatsiata triabva da se vseme ot edin .log file. Databazata e SQL
Napravih vruzkata s databazata i sega sledvashtata stupka e da istegla infoto ot .log faila v neia.
Dosegashnia kod e tova:
Dim ConnectionToDatabase 'this is the variable which will hold the connection string to the database
dim DatabaseCommand 'this variable will hold the db command
dim Recordset 'this is the value returned by the db
Set ConnectionToDatabase=CreateObject("ADODB.Connection")
Set DatabaseCommand=CreateObject("ADODB.Command")
Set Recordset=CreateObject("ADODB.RecordSet")
ConnectionToDatabase.Open "provider=SQLOLEDB;server=backup1;database=AverageSize","AverageSA","anytime"
DatabaseCommand.CommandText = "Select * from Average"
DatabaseCommand.CommandType = 1
DatabaseCommand.ActiveConnection = ConnectionToDatabase
Recordset.Open DatabaseCommand
WScript.Echo Recordset.GetString
ConnectionToDatabase.Close
Blagodaria na vseki otzoval se
Znachi iformatsiata triabva da se vseme ot edin .log file. Databazata e SQL
Napravih vruzkata s databazata i sega sledvashtata stupka e da istegla infoto ot .log faila v neia.
Dosegashnia kod e tova:
Dim ConnectionToDatabase 'this is the variable which will hold the connection string to the database
dim DatabaseCommand 'this variable will hold the db command
dim Recordset 'this is the value returned by the db
Set ConnectionToDatabase=CreateObject("ADODB.Connection")
Set DatabaseCommand=CreateObject("ADODB.Command")
Set Recordset=CreateObject("ADODB.RecordSet")
ConnectionToDatabase.Open "provider=SQLOLEDB;server=backup1;database=AverageSize","AverageSA","anytime"
DatabaseCommand.CommandText = "Select * from Average"
DatabaseCommand.CommandType = 1
DatabaseCommand.ActiveConnection = ConnectionToDatabase
Recordset.Open DatabaseCommand
WScript.Echo Recordset.GetString
ConnectionToDatabase.Close
Blagodaria na vseki otzoval se