Results 1 to 15 of 15

Thread: SQL problem?

  1. #1

    Thread Starter
    Lively Member WiseGuy's Avatar
    Join Date
    Apr 2002
    Location
    Zierikzee, The Netherlands
    Posts
    98

    SQL problem?

    I have a little problem with filling a grid.
    When I fill my grid I get a value in a column wich is always 0 or 1.
    But I want to show yes or no in the grid.
    So 0=no and 1=yes.
    Where and how should I define this? In the SQL statement or in VBcode?


    WiseGuy
    I stuck my head out of the window and got arrested for mooning!

    This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
    O/S: Windows XP Professional (dutch)
    Internet: Cable (1Mbit connection)

  2. #2
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    I would do it in the VB-code.

    The problem is if you do it in SQL (if it is possible) you would do it for all records. In VB-code you do it only for the current record, it is faster.

    Franky

  3. #3

    Thread Starter
    Lively Member WiseGuy's Avatar
    Join Date
    Apr 2002
    Location
    Zierikzee, The Netherlands
    Posts
    98
    Okey so I should do it in VB but how do I do that?
    Could you give a small example something that could help me get started?

    WiseGuy

    B.T.W. I'm using the MSHFlexGrid with an Oracle DB
    I stuck my head out of the window and got arrested for mooning!

    This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
    O/S: Windows XP Professional (dutch)
    Internet: Cable (1Mbit connection)

  4. #4
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    create on your form a CheckButton
    Then write:

  5. #5

    Thread Starter
    Lively Member WiseGuy's Avatar
    Join Date
    Apr 2002
    Location
    Zierikzee, The Netherlands
    Posts
    98
    I don't think that it'll work when I write:





    LOL



    WiseGuy
    I stuck my head out of the window and got arrested for mooning!

    This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
    O/S: Windows XP Professional (dutch)
    Internet: Cable (1Mbit connection)

  6. #6
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    create on your form a CheckButton

    rsTest is the Recordset

    Then write:


    myForm.chkYesNo = rsTest!YesNoField


    Because your field have 0 for No and 1 for yes.

    Thats all

    Franky

  7. #7

    Thread Starter
    Lively Member WiseGuy's Avatar
    Join Date
    Apr 2002
    Location
    Zierikzee, The Netherlands
    Posts
    98
    I don't really understand what you mean. I've tried the thing you said but it did't work.
    Also I assumed that with Checkbutton you meant Checkbox.
    Here is what I made of it:

    VB Code:
    1. Private Sub Check1_Click()
    2. frmPlanningBrowse.Check1 = rs!blokkeren
    3. End Sub

    Here's the entire SQL code if its of any use:

    VB Code:
    1. strSQL = "   SELECT  PO.Verstoring, PO.OpdrachtId, PO.Bonnummer, " & _
    2.             "          PO.ReceptId, A.ArtikelNaam, RT.TypeCode, " & _
    3.             "           PO.RetourID, PO.RetourHoeveelheid, " & _
    4.             "           PO.Plandatum, PO.ChargeGewicht, " & _
    5.             "           PO.AantalCharges, PO.AantalGereed, " & _
    6.             "           PO.StartDatumTijd, PO.LotnummerWas, " & _
    7.             "           PO.Bestemming, R.Versie, PO.Status, " & _
    8.             "           PO.Blokkeren, PO.Commentaar, " & _
    9.             "           R.ChargeGewichtKg, R.Datum, PO.ProductCode, " & _
    10.             "           PO.IsOrder, R.NieuwRecept, PO.IsVerwijderd, " & _
    11.             "           PO.OperatorInvoer " & _
    12.             "   From    ReceptType RT, Recepten R, Artikelen A, ProductieOrders PO " & _
    13.             "   WHERE   RT.ReceptTypeId = R.ReceptTypeId (+) and " & _
    14.             "           R.ReceptId = PO.ReceptId (+) and " & _
    15.             "           PO.ReceptId = A.ArtikelId and " & _
    16.             "           PO.IsVerwijderd = 0 " & _
    17.             "  ORDER BY PO.Verstoring, PO.OpdrachtId "

    WiseGuy
    I stuck my head out of the window and got arrested for mooning!

    This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
    O/S: Windows XP Professional (dutch)
    Internet: Cable (1Mbit connection)

  8. #8
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    hi

    Before i sent this to you i checked it and it worked.

    So, there is a problem. But that is normaly not a big problem. Just write then for example:

    if rs!blokkeren = 0 then
    frmPlanningBrowse.Check1 = TRUE
    else
    frmPlanningBrowse.Check1 = FALSE
    end if

    The only problem can be the type of the field. if it is a numeric then you can use my code from before, if it is a textfield, then you can use the code from before and val(rs!blokkeren)

    Franky


    Your sqlCommand looks ok.

  9. #9

    Thread Starter
    Lively Member WiseGuy's Avatar
    Join Date
    Apr 2002
    Location
    Zierikzee, The Netherlands
    Posts
    98
    Well, I still can't get it work but If I understand your code then the checkbox indicates wether it's true or false but I want to show in the grid wether it is true or false. And preferably 'Ja' or 'Nee' (Dutch for yes or no).

    WiseGuy

    BTW it is a character field (Char)
    I stuck my head out of the window and got arrested for mooning!

    This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
    O/S: Windows XP Professional (dutch)
    Internet: Cable (1Mbit connection)

  10. #10

    Thread Starter
    Lively Member WiseGuy's Avatar
    Join Date
    Apr 2002
    Location
    Zierikzee, The Netherlands
    Posts
    98
    With the first code I keep getting the runtim-error 3021 "BOF or EOF is true, or the current record has been removed.... etc."


    WiseGuy
    I stuck my head out of the window and got arrested for mooning!

    This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
    O/S: Windows XP Professional (dutch)
    Internet: Cable (1Mbit connection)

  11. #11
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    Then don't use a checkBox, use a textfield:

    txtBlokkeren.Enabled = TRUE
    if trim(rs!blokkeren) = "0" then
    txtBlokkeren.Text = "Nee"
    elseif trim(rs!blokkeren) = "1" then
    txtBlokkeren.Text = "Ja"
    else
    txtBlokkeren.Text = " "
    end if
    txtBlokkeren.Enabled = False

    Franky

  12. #12

    Thread Starter
    Lively Member WiseGuy's Avatar
    Join Date
    Apr 2002
    Location
    Zierikzee, The Netherlands
    Posts
    98
    hmm, still getting the same error.

    VB Code:
    1. If question = you_know_any_other_solutions
    2. Then answer = "I'd like to hear them from you"
    3. else too_bad

    LOL


    WiseGuy
    I stuck my head out of the window and got arrested for mooning!

    This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
    O/S: Windows XP Professional (dutch)
    Internet: Cable (1Mbit connection)

  13. #13
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    Attach please your DB with some records.

    And your project. I will check it.

    I am sure that my way works. there must be something with your DB.

    Which result you get when you make before this IF-Then a msgbox with msgbox rs!blokkeren ?

    Franky

  14. #14

    Thread Starter
    Lively Member WiseGuy's Avatar
    Join Date
    Apr 2002
    Location
    Zierikzee, The Netherlands
    Posts
    98
    I'm sorry I can't post the DB: for 1 it's Oracle and second it contains calassified information of recepies from a big multi national company called Zeelandia. But that's irrelevant. I can send you the entire project but I don't think that's of any use without a DB.

    WiseGuy

    Which result you get when you make before this IF-Then a msgbox with msgbox rs!blokkeren ?
    I'll try this
    I stuck my head out of the window and got arrested for mooning!

    This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
    O/S: Windows XP Professional (dutch)
    Internet: Cable (1Mbit connection)

  15. #15
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    Of course you can send the DB. If it is classified then just send 2 Records in each table and if nec. change the text in the fields.
    But then it will be no problem anymore
    Oracle to load is for me no problem here.

    Franky

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