Results 1 to 16 of 16

Thread: record source problem

  1. #1

    Thread Starter
    Junior Member tyrant's Avatar
    Join Date
    Sep 2005
    Location
    Vukovar/Croatia
    Posts
    27

    record source problem

    no i'm sick of this
    i spent whole afternoon searching the web and this forum for my answer
    which i had and would have it but that jerk had to format the memory stick
    grrrrrrrrrrrrrrrrrrrrrrrrrr

    so here is the problem after a long brake of doing nothing i decided to make db app
    now i remeber that i once found on the web something like this

    adodc1.recordsource = "select * from and i do not know the rest
    i found on this forum some topics with similiar code but it doesn't work and it is always .Open not .recordsource

    i'm not some expert i'm just a kid (15 yrs) and really bad amateur
    i want to find recordset in db using string in lets say Text1.text

    by using code i found on the forum i would end up with this stupid err

    Syntax error in FROM clouse

    the code i'm using

    VB Code:
    1. Adodc1.RecordSource = "select ime " & _
    2.                         "from baza where " & _
    3.                         "ime= '" + Text4.Text + "'"
    4. Adodc1.Refresh
    Skipper, shall we tell them that the boat is out of gas!

    Nah just smile and wave boys, just smile and wave!!!!!!!

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: record source problem

    Quote Originally Posted by tyrant
    no i'm sick of this
    i spent whole afternoon searching the web and this forum for my answer
    which i had and would have it but that jerk had to format the memory stick
    grrrrrrrrrrrrrrrrrrrrrrrrrr

    so here is the problem after a long brake of doing nothing i decided to make db app
    now i remeber that i once found on the web something like this

    adodc1.recordsource = "select * from and i do not know the rest
    i found on this forum some topics with similiar code but it doesn't work and it is always .Open not .recordsource

    i'm not some expert i'm just a kid (15 yrs) and really bad amateur
    i want to find recordset in db using string in lets say Text1.text

    by using code i found on the forum i would end up with this stupid err

    Syntax error in FROM clouse

    the code i'm using

    VB Code:
    1. Adodc1.RecordSource = "select ime " & _
    2.                         "from baza where " & _
    3.                         "ime= '" + Text4.Text + "'"
    4. Adodc1.Refresh
    Take a look at the ADO examples in my signature.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: record source problem

    its your SELECT Statement

    if you have that short of a line u dont really need to split it (but u can if u want)

    Adodc1.RecordSource = "select ime from baza where ime= '" & Text4.Text & "'"

    changed + to &

    + adds.. & concats
    when combinig strings always use &
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    Re: record source problem

    I'm afraid you are mixing things up.

    addoc1.recordsource is a connection made in designtime to populate a form with records from a recordset. The parameters fot the connection are set at design time and the form is called a BoundForm. Controls on the form can use this data source to display 1 or more fields from the addoc1.recordsource.
    The data shown is the data from the current record. moving up or down the recordset will trigger displaying the new data on the form.

    So re-using the addoc1 connection to use a diffrent datasource would require building it at design time at the first place.
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

  5. #5

    Thread Starter
    Junior Member tyrant's Avatar
    Join Date
    Sep 2005
    Location
    Vukovar/Croatia
    Posts
    27

    Re: record source problem

    @ [A51g]Static
    doesn't work
    still
    Syntax error in FROM clouse
    Skipper, shall we tell them that the boat is out of gas!

    Nah just smile and wave boys, just smile and wave!!!!!!!

  6. #6
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: record source problem

    do a Debug.Print Adodc1.RecordSource

    to see how it looks "for real"

    (UT Player?)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7

    Thread Starter
    Junior Member tyrant's Avatar
    Join Date
    Sep 2005
    Location
    Vukovar/Croatia
    Posts
    27

    Re: record source problem

    yes i'm an ut player

    about debug errrrrr
    where to put it
    btw after
    Syntax error in FROM clouse Error
    goes another one Runtime Error then a bunch of numbers and the Automation error
    Skipper, shall we tell them that the boat is out of gas!

    Nah just smile and wave boys, just smile and wave!!!!!!!

  8. #8
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: record source problem

    put the Debug.Print Adodc1.RecordSource
    right after you set Adodc1.RecordSource = "Select etc...
    then Open the Immediate Window (Debug Window)after you run it


    (Cant wait for UT07 looks incredible! Been hooked on BF2 lately.. very fun)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  9. #9

    Thread Starter
    Junior Member tyrant's Avatar
    Join Date
    Sep 2005
    Location
    Vukovar/Croatia
    Posts
    27

    Re: record source problem

    (aaaaahhhhhh playing anything on line beyond starcraft and warcraft is my dream bcs of two reasons:
    -i'm still on 56 k(hopefully adsl 384/128 in a month)
    -99 % of gamers here use illegal copy-s(i saving every lipa(eg. peny) for original bf2 then it is just too xpensive for gamers here bcs living standard ia waaaaaaaaay below american))


    aha here it is
    Method refresh of object IAdodc failed


    (i just hope that ut07 will run at least at minimal details and resulotion on this config:
    a64 3000+ vencie @ 1,8 ghz
    2 x 1gb ram ddr 400 by Super Talent
    gygabyte nx66t128 vp (6600gt @ 550/1180 @ 128 mb)

    i pray (to someone not god) every evning that it works on my machine(i do not bealeve in god))
    (btw how's my english, i'v always wondered is it understandable to you from usa and gb)
    Skipper, shall we tell them that the boat is out of gas!

    Nah just smile and wave boys, just smile and wave!!!!!!!

  10. #10
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: record source problem

    well
    first of all Your english is really good!! I did not even realize you were from Croatia!!
    second...UT07 .. if it does not run on that system.. I would be mad.. thats a nice system
    third... so the refresh is causing the problem...

    what if you try to do this without the control?

    create a new ADODB connection
    and do a recordset open with that SQL...
    see how that works
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  11. #11

    Thread Starter
    Junior Member tyrant's Avatar
    Join Date
    Sep 2005
    Location
    Vukovar/Croatia
    Posts
    27

    Re: record source problem

    damn it i tried with old sql but it doesn't work
    so i'm using this(still ain't working)
    i found it in old vb book that i dug up from my "ready for fireplace" bunch

    VB Code:
    1. Dim veza As New ADODB.Connection
    2. Dim rs As New ADODB.Recordset
    3. veza.Open Adodc1.ConnectionString
    4. rs.Open "select * from baza where ime= " + Text4.Text, veza, adOpenDynamic, adLockReadOnly, -1

    [offtopic]
    1.nice to know( here in balkanian subcontinent(i think that is the expresion for piece of land surounded with sea from three sides) most of people think that americans and other western country citizens never heard of croatia,serbia and montenegro,bosnia and herzegovina,slovenia etc..., well infact when i think it over it is a lie(bcs u must have heard of us from our wars '90 and new one with usa(there was no reason for that) in '99 in both wars i lost a close person, most of the people in the serbia lost someone during '99 and most of them wouldn't great any american or anyone from NATO with open hands , ok the exception are stupid politicans)
    2.yes it would be very stupid
    [/offtopic]
    Last edited by tyrant; Sep 15th, 2005 at 10:26 AM.
    Skipper, shall we tell them that the boat is out of gas!

    Nah just smile and wave boys, just smile and wave!!!!!!!

  12. #12
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: record source problem

    You need to build the Connection string


    Do a search.. you should find enough info on it...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  13. #13
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: record source problem

    Quote Originally Posted by [A51g]Static
    You need to build the Connection string


    Do a search.. you should find enough info on it...
    I'm a search and I have been done.
    VB Code:
    1. Dim ADOCn As ADODB.Connection
    2. Dim ConnString As String
    3. Dim adoRS As ADODB.Recordset
    4. Dim sSQL As String
    5.  
    6. ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    7.         "Data Source=c:\yourdbname.mdb;" & _
    8.         "Persist Security Info=False"
    9.  
    10. Set ADOCn = New ADODB.Connection
    11. ADOCn.ConnectionString = ConnString
    12. ADOCn.Open ConnString
    13. Set adoRS = New ADODB.Recordset
    14. sSQL = "SELECT * FROM baza WHERE ime = '" & Text4.Text & "' "
    15. adoRS.Open sSQL, ADOCn
    16. 'I have no idea what you want to do with the recordset
    17. 'but whatever it is, you would do it here.
    18. adoRS.Close
    19. ADOCn.Close
    20. Set ADOCn = Nothing
    21. Set adoRS = Nothing

  14. #14
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: record source problem

    I'm a search and I have been done
    Huh!??
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  15. #15

    Thread Starter
    Junior Member tyrant's Avatar
    Join Date
    Sep 2005
    Location
    Vukovar/Croatia
    Posts
    27

    Re: record source problem

    i don't know *** does this means
    No value given for one or more parameters.

    @hack
    i think i said it
    i want to when i enter the name in ime textbox and press certain command button, to show me recordset matching that name
    Skipper, shall we tell them that the boat is out of gas!

    Nah just smile and wave boys, just smile and wave!!!!!!!

  16. #16
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: record source problem

    Could you post your code? Have you edited the example Hack has shown?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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