Results 1 to 10 of 10

Thread: Back to basics: Accessing Database

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Back to basics: Accessing Database

    Right, well on many occasions i have accessed databases fine, but this occasion it wont work. Please can i have an example of accessing a database, with SQL based on a query.

    I am sure i can fill in the gaps.

    Thank You
    ILMV

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Back to basics: Accessing Database

    Check out the tutorials in the Database forum.

    http://www.vbforums.com/showthread.php?t=81916

    Cheers
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  3. #3

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Back to basics: Accessing Database

    No No Help?

  4. #4
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Back to basics: Accessing Database

    Exactly what sort of help do you need? Are you using DAO or ADO?
    Post the code you're having trouble with or give me some specifics and I'll try and knock something together for you.
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Back to basics: Accessing Database

    Quote Originally Posted by I_Love_My_Vans
    ... well on many occasions i have accessed databases fine, but this occasion it wont work. ...
    What exactly would that mean? Can you show us some code of yours that "won't work", please.

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

    Re: Back to basics: Accessing Database

    We really can't guess what exactly you are having trouble with, it would be better if you post your code where the problem is existing or be more elaborative on explaining it.
    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

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

    Re: Back to basics: Accessing Database

    What kind of database?

    Access
    SQL Server
    Oracle
    ?

  8. #8

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Back to basics: Accessing Database

    Sorry everyone.

    Right well i am using MS Access witd DAO...

    here is the code i have used so far, but it doesnt seem to find the record...

    Code to access record
    VB Code:
    1. SQLTXT = "SELECT Date, Subject, Entry"
    2. SQLTXT = SQLTXT + " From Entry"
    3. SQLTXT = SQLTXT + " WHERE Date = " & DatePicker.value
    4.  
    5. Set MySearch = MyDatabase.OpenRecordset(SQLTXT)
    6.  
    7. txtSubject.Text = MySearch!Subject
    8. txtEntry.Text = MySearch!Entry

    All variables are definetly defined, and the database has def been loaded.

    Thank you
    Ben @k@ ILMV

  9. #9
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Back to basics: Accessing Database

    Date is a keyword, surround it with square brackets. When a date value is used as a criteria it must be delimited by the # sign. To avoid other trouble, always use one of these date formats mm/dd/yyyy (Microsoft database standard), yyyymmdd (ISO standard) or a non ambiguous format such as dd-MMM-yyyy, when concatenating date values to a string. Also, get into the habit of using the & to concatenate strings.

    VB Code:
    1. SQLTXT = "SELECT [Date], Subject, Entry"
    2. SQLTXT = SQLTXT & " From Entry"
    3. SQLTXT = SQLTXT & " WHERE [Date] = #" & Format$(DatePicker.value,"mm/dd/yyyy") & "#"

  10. #10

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Back to basics: Accessing Database

    Oh my god i love you!!!

    Um, sorry.

    Cheers buddy, good effort.
    ILMV

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