A dictionary can not be multidimensional but an array can be.A dictionary has greater techniques to add new items and test for existing objects.When you delete a specific object from a dictionary, all the subsequent gadgets mechanically shift up. For example, in case you delete the second one item in a 3-object dictionary, the authentic 0.33 object mechanically shifts up into the second one-item slot.
Posted Date:- 2021-09-23 09:11:00
The Dictionary item shops name / price pairs (known as the key and item respectively) in an array.
Write the underneath code in a notepad and save it with a .Vbs extension and run it from Command Prompt with the aid of simply typing the name of the document.
Dim Beers
Set Beers = CreateObject("Scripting.Dictionary")
Beers.Add "a", "Strauss"
Beers.Add "b", "Kingfisher"
Beers.Add "c", "Budweiser"
Msgbox ("The cost similar to the important thing'b'is"&Beers.Item("b"))
The Dictionary object has many properties like Count, Item, CompareMode etc and plenty of strategies like Exists, Add, and Keys and so on.
Posted Date:- 2021-09-23 09:08:35
By default, arguments are exceeded to features and subroutines via reference; this is, the cope with of the argument is furnished to the feature or subroutine.
Posted Date:- 2021-09-23 09:06:59
VBScript is a case-insensitive programming language; i.E. Case is neglected while studying VBScript scripts. So myVar, MyVar, MYvar all talk to the equal variable.
Posted Date:- 2021-09-23 09:04:34
set xl=createobject(“excel.Utilityâ€)
set wb=xl.Workbooks.Open(“d:/pattern.Xlsâ€)
set ws=wb.Worksheets(1)
ws.Cells(three,4)=â€welcomeâ€
wb.Shop
wb.Near
set wb=nothing
set ws=not anything
set xl=not anything
Posted Date:- 2021-09-23 09:03:02
Order of assessment of operators is, first arithmetic operators are evaluated, and evaluation operators are evaluated subsequent and on the final logical operators are evaluated at the closing. In mathematics operators negation, Exponentiation, multiplication and division, integer division, modulus arithmetic, addition and subtraction and string concatenation are furnished.
Posted Date:- 2021-09-23 09:01:50
ADODB.Stream class may be used as string builder. VBScript string concatenation may be very luxurious due to common memory allocation functions. Binary document and reminiscence I/O operation is provided by ADODB.Stream magnificence. This is broadly used to convert bytes into string, etc.
Posted Date:- 2021-09-23 09:01:02
How to read from file and write into the file
set files = createobject(“scripting.filesystemobjectâ€)
set obj1=files.opentextfile(“d:file2.txtâ€,2,true) ‘ true uses for ceating txt file
set obj2=files.opentextfile(“d:file2.txtâ€,1,false) ‘ false will not create any file
obj1.writeline(“write this line into fileâ€)
str=obj2.readline
msgbox str
set files=nothing
Posted Date:- 2021-09-23 08:58:42
Tristate constants can be used with functions which allow formatting of numbers. These constants can be used with VB Script without defining them. It can be used anywhere in the code to reflect and represent the values.
Posted Date:- 2021-09-23 08:57:43
ADODB.Stream class can be used as string builder. VBScript string concatenation can be very costly because of frequent memory allocation features. Binary file and memory I/O operation is provided by ADODB.Stream class. This is widely used to convert bytes into string, etc.
Posted Date:- 2021-09-23 08:57:05
On Error Resume Next moves the control of the cursor to the next line of the error statement i.e. if any runtime error occurs at any particular line in the script then the control will move into the next line of the statement where the error has occurred.
Posted Date:- 2021-09-23 06:31:59
You can take measures to get minimum number of errors as possible by making use of Error Handling Mechanism in your scripts. Situations like issues in mathematical computations or any type of error can be handled with the help of Error Handling.
Posted Date:- 2021-09-23 06:31:29
CreateTextFile and OpenTextFile methods are used to create open text files and open text files respectively in the VBScript language.
Posted Date:- 2021-09-23 06:30:08
The RecordSet object is used for holding the records of the query which are extracted from the database.
Set obj = createobject(“ADODB.RecordSetâ€) is the statement for creating a RecordSet object.
Posted Date:- 2021-09-23 06:29:36
XOR Called Logical Exclusion operator. It is used to do an XOR operation.
Example:
A. Dim a : a = 5
Dim b : b = 10
Dim c
c = b XOR a
Document.write ("XOR Check is " &c)
Posted Date:- 2021-09-23 06:28:02
The Execute method works like Replace, except that it returns a Matches collection object, containing a Match object for each successful match. It doesn't modify the original string.
Posted Date:- 2021-09-23 06:26:52
This is a very important Interview Question which has been asked many times.
It is recommended to close the resource after its usage is completed although it’s not mandatory as library or driver ultimately will close the connection but this is required to avoid any negative effects due to improper closing of the connections which can even lead to a restriction in the access of the database by some of the users.
Posted Date:- 2021-09-23 06:26:20
This is used to open a database connection object/recordset object.
obj.Open“Provider=SQLQLEDB;Server=.SQLEXPRESS;UserId=test;Password=P@123;Database =AUTODB†is the connection string for opening a database connection.
The connection string is a very useful property and this is used for creating a database connection and includes connection information like details of the Driver, Database Server Name, Username, and Password.
Posted Date:- 2021-09-23 06:25:47
Connection Objects provide supports to the Coders to work and deal with the database. As such, there is not any straight-forward mechanism to connect to the database in QTP but by making use of ADODB Objects, you can interact with the database and work with the SQL Queries to fetch the data from the database.
ADO stands for ActiveX Data Objects and this provides a mechanism to act as an intermediary between the QTP and the Database.
Set obj = createobject(“ADODB.Connectionâ€) is the way to create a Connection Object.
Posted Date:- 2021-09-23 06:25:18
Excel Objects provide supports to the coders to work and deal with the Excel Sheets.
Set obj = createobject(“Excel.Applicationâ€) is the way to create an Excel Object.
Posted Date:- 2021-09-23 06:24:45
This Event occurs in case of the clicking of any button that is present on any HTML page.
Posted Date:- 2021-09-23 06:24:10
Using Ltrim function, which returns a string after removing the spaces on the left side of the specified string.
Posted Date:- 2021-09-23 06:23:44
+ operator concatenates two Values if values are string. So A + B will give VBScript.
Posted Date:- 2021-09-23 06:23:18
MouseOut Event is triggered when mouse focus comes out of an element in the VBScript language.
Posted Date:- 2021-09-23 06:22:51
According to the first letter in a string it returns the ANSI code relevant to that first letter. If string is not present, then a runtime error occurs. Asc function returns the first byte used. It is used only with elements containing byte data in a string.
Posted Date:- 2021-09-23 06:22:08
.hta extension is used whenever you want to include a VB script in HTML. Here HTML acts as an interface and VB Script as the programming language. .hta extension files do run in the safe and trusted zone of Internet explorer. Although they run in the trusted zone querying is restricted as it has to pass the guidelines of internet explorer.
Posted Date:- 2021-09-23 06:21:18
wsf files are modeled in similar to XML. They can be executed with the help of Wscript.exe and it can be done from the command line also. This .wsf file can have multiple visual basic files. Reuse functionality is present with this extension file.
Posted Date:- 2021-09-23 06:20:55
A simple example detailing the running of VB Script is by utilizing Windows Script host environment. Visual basic is a standalone application which has a .vbs as extension. Input can be provided through graphical user interface and output can be obtained by Wscript.exe from dialog and input boxes. From command line it can be invoked by Cscript. exe.
Posted Date:- 2021-09-23 06:19:11
document.cookie stores the information of key-value pairs and expiration date values of a Cookie.
document.cookie = “key1=name of the value1;key2=name of the value2,…….,expires=dateâ€.
‘;’ is used to separate the key-value pairs.
Posted Date:- 2021-09-23 06:13:52
Trim function is used to trim/remove the spaces from both the sides of the specified String.
Syntax: Trim(name of the string).
Posted Date:- 2021-09-23 06:12:17
Using Log function, which returns the natural logarithm of the given number.
Example:
Dim num : num = 210
document.write("Log Result of num2 is : " & Log(num2))& "<br/>" '5.34710753071747
Posted Date:- 2021-09-23 06:11:15
Using InStrRev function, which returns the first occurrence of one string within another string. The search happens from right to left.
Posted Date:- 2021-09-23 06:10:49
StrComp is used to compare the 2 strings and return values on the basis of the comparison. This returns 0 if string1 = string2,-1 if string1<string2,1 if string1>string2 and null if any of the strings is null.
Syntax: StrComp(name of the string1, name of the string2).
Posted Date:- 2021-09-23 06:10:26
SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle database. SQL*Loader supports various load formats, selective loading, and multi-table loads. When a control file is fed to an SQL*Loader, it writes messages to the log file, bad rows to the bad file and discarded rows to the discard file.
Control file:
The SQL*Loader control file contains information that describes how the data will be loaded. It contains the table name, column datatypes, field delimiters, etc.
controlfile.sql should be used to generate an accurate control file for a given table.
Log File:
The log file contains information about the SQL*loader execution. It should be viewed after each SQL*Loader job is complete.
Posted Date:- 2021-09-23 06:10:05
The SMON background process performs all system monitoring functions on the oracle database.
Each time oracle is re-started, SMON performs a warm start and makes sure that the transactions that were left incomplete at the last shut down are recovered.
SMON performs periodic cleanup of temporary segments that are no longer needed.
Posted Date:- 2021-09-23 06:09:22
These statements are acceptable for specific conditions, but they often make code less readable, which makes it difficult for others who look at your code to know what's really going on. If you make sure the only way out of a loop is to not satisfy the loop's condition, it's much easier to follow your code. Often, breaking out of a loop by force with an exit statement is a sign of a poorly constructed loop with a condition that does not meet your goals. Take a look at the loop structure and condition again to make sure you're not leaving something out.
Posted Date:- 2021-09-23 06:08:58
The VBScript code that comes along in a Web page cannot directly access any files on the client's computer. This prevents a Web page from making any modifications to sensitive files on the user's computer. VBScript is also very safe in that it doesn't give programmers the ability to create unrecoverable crashes by virtue of its language syntax.
Posted Date:- 2021-09-23 06:08:36
Len function is used to get the length of a specified string i.e. the total number of characters of a specified String.
Syntax: Len(name of the string).
Posted Date:- 2021-09-23 06:08:14
cDate is used to convert a valid expression into a Date type value. The syntax of this is cDate(date) i.e. any valid Date/Time expression will be converted into a particular Date.
Posted Date:- 2021-09-23 06:07:49
This is a format function which is used to convert the Date to some specific format based on the parameters that are supplied to the function. The syntax of this is FormatDateTime(Date, Format). This is a widely used format function.
Posted Date:- 2021-09-23 06:07:29
DateDiff function is used to fetch the difference between the 2 dates that are specified as parameters on the basis of the interval specified.
Posted Date:- 2021-09-23 06:07:01
This is a very important Interview Question that has been asked many times.
REDIM statement is used to re-define the size of an array. When the array is declared without any size, an array can be declared again using REDIM with the feasibility of specifying the size of an array.
PRESERVE keyword is used to preserve the contents of a current array when the size of an array gets changed.
Posted Date:- 2021-09-23 06:06:32
The On Error Resume Next statement provides you some degree of error handling by preventing program interruptions from runtime errors.
When an error occurs, by using this statement, the line of code containing the error is simply skipped over and the program continues.
On Error Resume Next statement does not correct an error, just ignore it, without even displaying the error message.
The Statement essentially has two ways it is used. First to turn off the script engine error checking:
On Error Resume Next
The second is to turn it on, thereby allowing the script engine to stop execution of a script when an error is encountered. Like so:
On Error Goto 0
Posted Date:- 2021-09-23 06:06:02
A dictionary can't be multidimensional but an array can be.
A dictionary has extra methods to add new items and check for existing items.
When you delete a particular item from a dictionary, all the subsequent items automatically shift up. For example, if you delete the second item in a three-item dictionary, the original third item automatically shifts up into the second-item slot.
Posted Date:- 2021-09-23 06:05:21
Join function combines multiple substrings into a String. Here, the string returned value includes various substrings in an array and thus joins all the substrings into one string.
Syntax: Join(array,[delimiter]. Using delimiter is an optional condition.
Posted Date:- 2021-09-23 06:04:13
lbound indicates the smallest subscript or index of an Array in the VBScript language and this always returns 0, as the index value of an Array always starts from 0.
ubound returns the largest subscript of a defined array or can say it indicates the size of an Array. If the size of an array is 5 then the value of the ubound is 5.
Posted Date:- 2021-09-23 06:03:59
cDate is one of the frequently used conversion functions for converting the expression which includes Date or Time parameter into Date subtype.
cStr is the conversion function which is used for converting the expression into the String subtype.
Posted Date:- 2021-09-23 06:03:41
The 2 ways to pass a value to the function are:
* Pass by Value: When arguments are passed and any changes that take place in the Called procedure in the value of a variable does not persist then it means it is passing by value. The keyword used in this case is ByVal.
* Pass by Reference: When arguments are passed and any changes that take place in the Called procedure in the value of a variable persist then it means it is passing by reference. The keyword used in this case is ByRef.
Posted Date:- 2021-09-23 06:03:09
There are 2 types of Procedures in the VBScript language – Sub Procedures and Function Procedures.
Sub is a type of procedure that includes a set of statements inside the block of the code and after execution, it does not return any value.
The Function is a type of procedure that includes a set of statements inside the block of the code and after execution, it may return value also. This can take input if required, depending on the situation.
Posted Date:- 2021-09-23 06:02:15
Do While Loop first checks the condition and if it is true only after that the statements are executed and in case of Do Until, the loop will be executed until the condition becomes false.
Posted Date:- 2021-09-23 06:01:59