C#-APP- Renaming an Access table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cbbibleboy
    New Member
    • Apr 2007
    • 29

    C#-APP- Renaming an Access table

    Hey! I posted this first on the MS Access forum, but as I have not gotten any results, I wonder if it would fit better on the C# forums (overlaps between the two). I'm trying to rename a table in Access through C#, and I've tried using the “SELECT * INTO new_table_name FROM old_table_name” method, but I'm afraid it is not working. My exact code is:

    Code:
    OleDbCommand CMD = new OleDbCommand("SELECT * INTO " + _newName + " FROM " + _oldName + ")", clsDatabase.Connection);
    CMD.ExecuteNonQuery();
    Yet an exception is thrown every time:

    -------------------------------------------
    Syntax error in FROM clause.
    -------------------------------------------

    It's very mysterious and I'd really appreciate your help. I'm using C# 2005 with a 2002-formatted Microsoft Access database on Windows XP. Thanks!
Working...