Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exporting QTP runtime datatable to SQL server during
#1
Not Solved
Hi Team,

I am importing datatable from sql server in the global sheet, then modifying few column data.
After modification, I want to write back the changes(runtime datatable) to the same datatable in the sql server database.

Is it possible to do? If yes, can you please suggest a sample code.
Reply
#2
Not Solved
Its possible. given the Update access previlages to your DB.
i dont have sample code.
bt u can do this in similar way how you caonnect to the DB and query the DB


U can write a update query and execute it.

Thanks
Sonu
Code:
Function db_connect( strSQL )
        Set o_CON =CreateObject("ADODB.Command")
        Set o_RS= CreateObject("ADODB.RecordSet")
        serverName =  Left(Environment.Value("LocalHostName"), 4)&"svr"'Inputbox("Enter the DB server Name")
        If Trim( serverName)  ="" Then
            's_ConnectionString =  "dsn=" & "yourDB"
            serverName ="yourdbserver"
            s_ConnectionString ="driver=sql server;server="& serverName  &";database=yourDB;uid=yourdbuserid;pwd=yourpassword*"
        Else
         s_ConnectionString ="driver=sql server;server="& serverName  &";database=yourDB;uid=yourdbuserid;pwd=yourpassword*"
        End If
        
        o_CON.ActiveConnection = s_ConnectionString
        o_CON.CommandText= strSQL
        Set o_RS =o_CON.Execute
        Set db_connect = o_RS
End Function
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SQL Query Issue in QTP rajiv.qtp 1 2,485 11-28-2013, 10:36 AM
Last Post: Jay
  Does QTP support writing runtime data to multiple sheets in excel Shwethareddy 2 3,679 10-16-2012, 12:20 PM
Last Post: Shwethareddy
  Coloring cell of runtime datatable indranilgoswamimcb 3 10,977 08-03-2012, 03:51 PM
Last Post: SteveS
  SQL on oracle database doesn't return a value Bluefields 2 3,249 07-09-2012, 01:23 PM
Last Post: Bluefields
  How to read a unix flat file from a unix server using QTP vinayjames.b05 3 9,561 06-18-2012, 11:12 PM
Last Post: gunaseakaran

Forum Jump:


Users browsing this thread: 1 Guest(s)