Results 1 to 3 of 3

Thread: vb6+mysql+execute

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    Israel the holy land
    Posts
    160

    vb6+mysql+execute

    in vb6 i make insrt's into mysql
    like this :
    VB Code:
    1. cnMySql.Execute ("insert into xxx (p1) values('aaa')
    how can i get the result id of the execution?
    (in php there is a function called mysqli_insert_id() which gives me the insert id)
    what to do?
    thanks in advance
    peleg
    Last edited by Electroman; Feb 20th, 2005 at 09:39 AM. Reason: Corrected VBCode tags
    Israel - the best place to live in after heaven, but no one want's to go there so fast.

    http://www.networked-toys.com/
    http://www.nirlat.com/home_page.asp

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: vb6+mysql+execute

    This is also a function in MySql, so it can be included in a query:
    Code:
    SELECT LAST_INSERT_ID() id;
    +----+
    | id |
    +----+
    |  5 |
    +----+
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    Israel the holy land
    Posts
    160

    Re: vb6+mysql+execute

    first thnaks alot it works!!!
    second when i want fro example to do a select syntax i do :
    VB Code:
    1. With rdoQry
    2.  
    3.     .SQL = "select * from tbl1"
    4.     .RowsetSize = 1
    5.     Set .ActiveConnection = cnMySql
    6.     Set rdoRS = .OpenResultset(rdOpenKeyset, rdConcurRowVer)
    7. End With
    the thing is if i after few rows of code want to do another select syntx like :
    VB Code:
    1. With rdoQry
    2.  
    3.     .SQL = "select * from orders"
    4.     .RowsetSize = 1
    5.     Set .ActiveConnection = cnMySql
    6.     Set rdoRS = .OpenResultset(rdOpenKeyset, rdConcurRowVer)
    7. End With
    it fails!
    why is that?
    thnaks again
    Peleg
    Israel - the best place to live in after heaven, but no one want's to go there so fast.

    http://www.networked-toys.com/
    http://www.nirlat.com/home_page.asp

Posting Permissions

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



Click Here to Expand Forum to Full Width