Hi All,
I am facing typical scenario is how to return the value from vbs file to
java class.
Please see the below code for better understanding...
Vbs Code:
RetrunValue=DBConnction()
Function DBConnction()
Dim objConnection
'Set Adodb Connection Object
Set objConnection = CreateObject("ADODB.Connection")
Dim objRecordSet
'Create RecordSet Object
Set objRecordSet = CreateObject("ADODB.Recordset")
Dim DBQuery 'Query to be Executed
DBQuery = "Select NAME from dbo.EMPLOYEE where AGE = 29"
'Connecting using SQL OLEDB Driver
objConnection.Open "Provider=sqloledb;Server=10.91.64.12;User
Id=sa;Password=sunp@55;Database=VIMS"
'Execute the Query
objRecordSet.Open DBQuery,objConnection
'Return the Result Set
Value = objRecordSet.fields.item(0)
'msgbox Value
DBConnction=Value
' Release the Resources
objRecordSet.Close
objConnection.Close
Set objConnection = Nothing
Set objRecordSet = Nothing
End Function
Java Code:
package programs;
public class DBConnection {
public static void main(String[] args) {
try
{
Process p= Runtime.getRuntime().exec("wscript.exe
C:\\Users\\venkatak\\Desktop\\DBConnection.vbs");
p.getOutputStream().toString();
}
catch(Exception e)
{
e.getMessage();
}
}
}
I am able to invoke the DBConnection.vbs file and execute that file and
print the file. I would like to use those vbs output file inot our java
class.
Please let me know if you have any idea about these concepts.
Thanks,
Venkat
--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
---
You received this message because you are subscribed to the Google Groups "QTP
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.