Results 1 to 13 of 13
  1. #1
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303

    Red face Unanswered: Parameter on VB6

    hi to all,
    I have the procedure like this used vb6 not a stored procedure in Ms Sql.

    Sub sqlselect()
    dim SStr as string
    SStr= "Select * from Customer where cust_code=@cust_code"
    set rs=cn.execute(SStr)
    End sub

    But when I execute this procedure error is encouter.

    Comments or suggestion highly appreciated.

    thanks...

  2. #2
    Join Date
    Jul 2004
    Posts
    69
    since you're using a procedure, why not use a typical vb variable to hold the value of cust_code instead of having the @ for stored proc? and use a recordset to obtain the results...just a suggestion...

  3. #3
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303
    hi dan,
    To prevent the error when the use enter a string with char ='
    because i have already try this in SProcedure, its work fine.

    Thanks...

  4. #4
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303
    dan,
    magbisaya lang ko dan kay dili mako fluent sa english, sa akong inventory nga program sa vb6 na sitwasyon naglisod ko.
    ang scenario mao ni. naay usa ka item with only one quantity, what if the 2 users magdungan sila pagtransact with the same item and I want to lock 1 of the user prevent the onhand qty not equal to negative.
    thanks kaayo sa imong idea, beginners paman ko danhing vb6 sa delphi nuon nakuha naman ni nako.

    henry...

  5. #5
    Join Date
    Jan 2005
    Posts
    5

    Question elloz

    hi there, you're doing vb sql too?? are u good in it??

  6. #6
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303
    HI,
    YAP, not realy. How about yuo?

  7. #7
    Join Date
    Jul 2004
    Posts
    69
    pops,

    sa situwasyon nga ing-ana, dba ang sql server nman ang bahala bout the locking mechanism and stuff...dili nata maghisgot ug technical kaau. pero kung in a worst-case scenario, maybe we can have a "little" de-structuring sa atong table, maybe pwede nato butangan ug usa ka row/field nga mu-trigger sya if it's used up or something like it. just an idea lang pops kay obviously, pain-in-the-ass jud kaau ning ing-ani nga scenario. so we must think of other ways or alternatives nga at least muga-an atong trabaho nga dili ta maglisod, dba? hehehe...just a suggestion lang pops

  8. #8
    Join Date
    Jan 2005
    Posts
    5
    i got some probs too.. know how to retrieve database to listbox? using sql ?

  9. #9
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303
    Try this pre
    Set Rs = Connection.Execute("Select * From table")
    While not Rs.EOF
    list1.additem(Rs!field)
    Rs.movenext
    Wend


    'or try another way set the datasource name of list1 to rs

  10. #10
    Join Date
    Jan 2005
    Posts
    5
    where should i put this coding, at form load?
    and what if i want to show all the fields from the table..
    can it be done?
    i'm a bit blur on the codings, what if my table name is stocks, does it goes like that?

    Set Rs = Connection.Execute("Select * From Stocks")
    While Not Rs.EOF
    List1.AddItem (Rs!Index)
    Rs.MoveNext
    Wend

    and what is the Rs thing? must i dim it?
    it shows complie error on "Rs ="

    i'm sorry if it is too complicated or too long maybe u want to email me? or u do have msn or something?
    Last edited by guitarmel; 01-13-05 at 21:19.

  11. #11
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303
    DIM CN AS NEW ADODB.CONNECTION
    DIM RS AS NEW ADODB.RECORDSET
    'IN THE FORM LOAD TYPE THIS CODE
    WITH CN
    .CONNECTIONSTRING ="YOUR CONNECTION STRING"
    .OPEN
    END WITH

    ' BUTTON CLICK TYPE THIS
    Set Rs = Connection.Execute("Select * From Stocks")
    ' ADD MSFLEXGRID ON YOUR FORM
    ALL FIELDS ON THE STOCK
    SET MSFLEXGRID.DATASOURNAME =RS
    Last edited by popskie; 01-13-05 at 23:53.

  12. #12
    Join Date
    Jan 2005
    Posts
    1

    Exclamation About data report

    ATTENTION: URGENT Response Needed!
    i just wanna ask: How would you retrieve a particular record from a database to a data report? i need an SQL right? tnx....

    Pinoys: Paano mo hahanapin ung 1 record sa database tapos ililipat sa data report for printing purposes..salamat mga henyo...

  13. #13
    Join Date
    Oct 2004
    Location
    In cousin's house
    Posts
    303
    Pare ,
    Pasensiya kana hindi pako nakagamit ng datareport for printing kasi crystalreport 7.

Posting Permissions

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