You can use the Dynamic DSN Query string which will be machine independent e.g. ' Count the rows for returned recordset Dim oConn, oRS, iCounter,sWorkBook,sQuery Set oConn = CreateObject("ADODB.Connection") Set oRS = CreateObject("ADODB.RecordSet") oConn.Open "DRIVER={Microsoft Excel Driver (*.xls)};DBQ=" & sWorkBook & ";Readonly=True" oRS.Open sQuery, oConn, 3, 3, 1 iCounter=0 While oRS.EOF = False iCounter=iCounter+1 oRS.MoveNext Wend Set oRS=Nothing oConn.Close Set oConn=Nothing
How to connect database by using QTP tooland also how can we create 'dsn'.do we create 'dsn'