Results 1 to 14 of 14

Thread: accesiing data from database...

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    33

    accesiing data from database...

    i want to access the data from database..i already connected (.mdb database )in my vb. i want to accesss data to text box,combo box from the database...etc plz any one tell the code

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: accesiing data from database...

    Thread moved from the 'CodeBank VB6' forum (which is for you to post working code examples, not questions) to the 'Database Development' forum

    As you have already been told in another thread, there is a good tutorial at the start of the "Classic VB: ADO" section of our Database Development FAQs/Tutorials (at the top of this forum)

    When you have already been given a tutorial, it is rather rude to ask us to spend our time re-writing it specifically for you. Even if somebody was willing to do it, it wont be as good as the one you have been told to look as, because they wont put in anywhere near as much effort as they would for a tutorial that will be read by thousands of people.

    Go thru the tutorial, and if you can't solve your issue after that, ask for help with specific issues that you don't understand.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    33

    Re: accesiing data from database...

    i saw this if u know the coding plz post it........

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    33

    Re: accesiing data from database...

    if u know coding plz tell..........

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: accesiing data from database...

    I have already told you - the code (with explanations) is in the tutorial, why are you asking us to write it again?


    In addition to that, do not bump your threads. For some of the reasons, see this. People will read your thread (and hopefully reply) when they get the time to do so.

  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    33
    Code:
    Private Sub Form_Load()
    con.ConnectionString = "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & App.Path & " \AirLines.mdb"
    con.Open
    rs.Open "Select * from Flight_Details order by SrNo", con, adOpenDynamic
    Filling
    Values
    
    end sub
    ----------------------------------------------------------
    
    
    Sub Values()
    Dim i
    If rs2.State = 1 Then rs2.Close
    rs2.Open "Select max(SrNo) from Flight_Details ", con
    i = rs2.Fields(0) + 1
    If rs.EOF = True Or rs.BOF = True Then
        If txtsr.Text < i Then
            MsgBox "Class Not Found", vbInformation, "Airlines"
            cmbclasscode.SetFocus
        Else
        End If
            Exit Sub
    End If
    txtsr.Text = rs.Fields(4)
    txtcode.Text = rs.Fields(0)
    txtfare.Text = rs.Fields(2)
    txtseats.Text = rs.Fields(3)
    If rs1.State = 1 Then rs1.Close
    rs1.Open "Select Airline_name from Airlines_Master where Aircode ='" & Mid$(rs.Fields(0), 1, 2) & "'"
    txtflight.Text = UCase(rs1.Fields(0))
    cmbnum.Text = Mid$(rs.Fields(0), 3, 4)
    cmbcode.Text = Mid$(rs.Fields(0), 1, 2)
    If rs1.State = 1 Then rs1.Close
    rs1.Open "Select ClassName from Class_Master where ClassCode='" & rs.Fields(1) & "'", con
    If rs1.EOF = True Or rs1.BOF = True Then
    MsgBox "No Records To Display", vbInformation, "Airlines"
    Exit Sub
    End If
    cmbclasscode.Text = UCase(rs1.Fields(0))
    i written this code but it shows some error....

    like sub or function not defined this is the errror i got during compilation.....
    Last edited by si_the_geek; Oct 3rd, 2010 at 08:19 AM. Reason: was needlessly spread across 3 posts

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: accesiing data from database...

    Which line did the error highlight?

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    33

    Re: accesiing data from database...

    first line .......

  9. #9

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    33

    Re: accesiing data from database...

    sub or function not defined this is the errror i got during compilation

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: accesiing data from database...

    Please stop posting multiple replies in a short space of time. Instead you should think a bit more carefully before you submit the first one, so that it includes everything you want to tell us.

    You need to be more specific about which line it is, because the first line is Private Sub Form_Load() , which could not generate that error.

  11. #11

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    33

    Re: accesiing data from database...

    sub or function not defined this is the error message .

  12. #12
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: accesiing data from database...


    We already know that, you have told us 3 times now.

    What we don't know (and I have asked twice already) is which line it occurred on.

  13. #13

    Thread Starter
    Member
    Join Date
    Sep 2010
    Posts
    33

    Re: accesiing data from database...

    when i compiled yellow colour is highlighted in the first line.

  14. #14
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: accesiing data from database...

    Quote Originally Posted by crazylith View Post
    sub or function not defined this is the error message .
    Well, that error means you are missing something! If you are talking about this line:

    vb Code:
    1. con.ConnectionString = "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & App.Path & " \AirLines.mdb"

    Make sure AirLines.mdb is in the correct folder (in this case the same one as your exe will be located in) and that you have installed Access on the target computer.

    With this line:

    vb Code:
    1. Filling

    It is complaining because the sub you are calling isn't in your project.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

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