SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Mar 2002
    Location
    san francisco, ca USA
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how do i store db data

    I've read the SilkTest language reference and I am trying to use the various db functions.

    here is the code..

    hdbc = DB_Connect ("dsn=QAORDERDBV2; pwd=mko01qaz; UID=sa")


    hstmt = DB_ExecuteSql (hdbc, "Select IspCode from requests where firstname = 'john' and lastname = 'doe'")

    print ("Here is the info in the requests table")
    print ()
    while (DB_FetchNext (hstmt, IspCode))
    print("ispcode: {IspCode}")

    DB_FinishSql (hstmt)
    DB_Disconnect (hdbc)

    I basically just want to be able to store the record "ISPCODES" into a variable. The silk manual is not helpful with this.

    Any help will be appreciated.


    ------------------

  2. #2
    Junior Member
    Join Date
    Mar 2002
    Location
    Chennai,India
    Posts
    13
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: how do i store db data

    hi.
    There is a datatype called RECORD.Create a variable of that type and store the data in that. The RECORD should be of the same format as the record in the table.
    Following is an example.
    [-] type PERSON is record
    [ ] Integer Number
    [ ] String Name
    [-] testcase temp() appstate none
    [-] recording
    [ ] HDATABASE hdbc
    ....
    [ ] PERSON p1
    [-] while DB_FetchNext(hs,p1)
    [ ] Print(p1)
    here PERSON is a record.P1 is the instance of it. I fetch the records into p1 and print them.
    Hope this helps u.
    regards,
    rajesh

    ------------------

  3. #3
    Super Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    1,882
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: how do i store db data

    try something like this:
    STRING IspCode
    LIST OF STRING lIspCodes

    hdbc = DB_Connect ("dsn=QAORDERDBV2; pwd=mko01qaz; UID=sa")


    hstmt = DB_ExecuteSql (hdbc, "Select IspCode from requests where firstname = 'john' and lastname = 'doe'")

    print ("Here is the info in the requests table")
    print ()
    while (DB_FetchNext (hstmt, IspCode))
    print("ispcode: {IspCode}")
    ListAppend (lIspCodes, IspCode)

    DB_FinishSql (hstmt)
    DB_Disconnect (hdbc)


    At the end you should have a LIST OF STRING where you can use values from.


    ------------------
    James Soderborg
    http://www.ameliortech.com
    jamesso@ameliortech.com

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:26 PM.

Copyright BetaSoft Inc.