Results 1 to 2 of 2

Thread: SQL, database, table, SELECT query question help!!! *RESOLVED*

  1. #1

    Thread Starter
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    SQL, database, table, SELECT query question help!!! *RESOLVED*

    background:
    ok i know this is simple...and i really don't know why i can't get it to work. i have an access database...that i didn't design...the database has forms and queries designed in it already...i'm designing an app to access the data in a different way....the table i'm trying to access is call Library Information....with that freaking space.

    problem:
    i write my sql statement in my oledbcommand as follows however i keep getting an exception that the table does exist, i thought that if you use [ ] around a table name with a space in it you can connect to the table...am i crazy? please help...anyway heres the code:

    VB Code:
    1. Private Sub LoadLibraries()
    2.         Dim LI As LibInfo
    3.  
    4.         Try
    5.             adoCmd = New OleDbCommand("SELECT ID, [Library Name] FROM [Libary Information]", adoCnn)
    6.             adoRdr = adoCmd.ExecuteReader
    7.  
    8.             While adoRdr.Read()
    9.                 LI.ID = adoRdr("ID")
    10.                 LI.LibName = adoRdr("Library Name")
    11.                 Me.lstbLibs.Items.Add(LI)
    12.             End While
    13.         Catch ex As Exception
    14.             MsgBox(ex.Message)
    15.         Finally
    16.             adoRdr.Close()
    17.             adoCmd.Dispose()
    18.             adoRdr = Nothing
    19.             adoCmd = Nothing
    20.         End Try
    21.     End Sub
    Last edited by vbdotnetboy; Jun 22nd, 2004 at 10:38 AM.

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  2. #2

    Thread Starter
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310
    I'M AN IDIOT!!!!!!!!!!!!!!!!!!!!! SIMPLE STUPID TYPE-O

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

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