Search This Blog

Welcome to Machers Blog

Blogging the world of Technology and Testing which help people to build their career.
Showing posts with label DotnetFactory. Show all posts
Showing posts with label DotnetFactory. Show all posts

Monday, October 3, 2011

Working with dotnetfactory in qtp for database retrieval

dim objConDotnet, objCmdDotnet

Set objConDotnet=DotNetFactory.CreateInstance("System.Data.Odbc.OdbcConnection","System.Data")
'objConDotnet.ConnectionString="Server=xxx; UID=yyy; DataBase=zzz"
strCon="DRIVER={Microsoft ODBC for Oracle};SERVER=XXX; UID=YYY; PWD=ZZZ"
objConDotnet.ConnectionString=strCon
Print objConDotnet.ConnectionString
Print TypeName(objConDotnet)
objConDotnet.ConnectionTimeOut=0
objConDotnet.Open()
Print Cstr(objConDotnet.State)
strSql= "Select Count(*) from where columnName=valuetoSearch"
Set objCmdDotnet=DotNetFactory.CreateInstance("System.Data.Odbc.OdbcCommand","System.Data")
objCmdDotnet.CommandText=strSql
objCmdDotnet.Connection= objConDotnet
strValue = objCmdDotnet.ExecuteScalar()
Print "The return Count is : " & CInt(strValue)
objConDotnet.Close()
Print Cstr(objConDotnet.State)