Results 1 to 3 of 3

Thread: strange SQL error in SQL Server

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    257

    strange SQL error in SQL Server

    I run this completely normal command:
    Function GetVehicleStatus() As DataTable
    Connection.Open()
    Dim strSQL As String = "SELECT * FROM Auto"
    Dim ReadOnlyTable As New DataTable
    Adapter.SelectCommand = New SqlClient.SqlCommand(strSQL, Connection)
    Adapter.Fill(ReadOnlyTable)
    Connection.Close()
    Return ReadOnlyTable
    End Function
    and get an error saying: "Invalid object name 'Auto'."
    But trust me, Auto exists as a table in the database. I'm looking at it right now in VS. I even tried it with another table name and I got the same thing. It apparently connect correctly cuz I got lots of testing stuff before this and the connection.open runs fine. There's no reason I can see that it shouldn't run anyone see anything wrong with it or something?
    I tried to end process on Visual Studio 2005
    but PETA stopped me saying it's smart enough
    to be a living creature

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: strange SQL error in SQL Server

    Is Auto a reserved word? It might be. Try SELECT * FROM [Auto]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2005
    Posts
    257

    Re: strange SQL error in SQL Server

    I tried another table name of Categories so if it is, it's not that For some reason VS seems to be locking the file which I don't remember it doing before. I have it open in the server explorer tab and when I tried to move or delete the database it wouldn't let me. That may have something do to with it. Also in class we had table ownership problems because the person who made the DB made it at their works (grrrr) so could that have something to do with it? I opened the project at home here and it just asked me if I wanted to make myself the table owner and I said yeah so I'm not sure what else would be wrong.
    Update: well here's something interesting. There's no database at all in my bin/debug folder. Where's the copy if never, copy if newer, copy always option again? I even re-added the DB in server explorer and it's not in my solution explorer list. Couldda sworn it gets added in there and that's where U set it.
    Last edited by Desolator144; Nov 12th, 2006 at 01:36 PM.
    I tried to end process on Visual Studio 2005
    but PETA stopped me saying it's smart enough
    to be a living creature

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