Search This Blog

Welcome to Machers Blog

Blogging the world of Technology and Testing which help people to build their career.

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)

2 comments:

STC Technologies said...

I want to implement a system which can search and retrieve the matched info form a database which will have more then 50 million records as fast as possible. STC Technologies

Jackson said...

You can create a new dataset/datatable and update the matched records in that and show for future manipulations. Ofcourse there are many other ways to do based on the requirements.