Script to Import Data From Database to Datatable in QTP

    0
    45
    Spread the love
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  

    Dim con,rs
    Set con=createobject(“adodb.connection”)
    Set rs=createobject(“adodb.recordset”)
    con.provider=”microsoft.jet.oledb.4.0″
    con.open”d:db.mdb”
    rs.open”select*from Stud”,con
    datatable.GetSheet(1).addparameter”STUD_NO”,””
    datatable.GetSheet(1).addparameter”STUD_NAME”,””
    datatable.GetSheet(1).addparameter”STUD_PAY”,””
    row=1
    Do While Not rs.EOF
    datatable.SetCurrentRow(row)
    datatable.Value (1,1)=rs.fields(“studno”)
    datatable.Value(2,1)=rs.fields(“studname”)
    datatable.Value(3,1)=rs.fields(“studpay”)
    row=row+1
    rs.movenext
    Loop

    But this is not a very good approach for this.We need to discuss more on this.

    Don't miss out!
    Subscribe To Newsletter

    Receive top technical news, lesson ideas, travel tips and more!

    Invalid email address
    Give it a try. You can unsubscribe at any time.

    Spread the love
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  

    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here