473,473 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

C# / Access 2002 - Problem renaming table

29 New Member
Hey! 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:

Expand|Select|Wrap|Line Numbers
  1. OleDbCommand CMD = new OleDbCommand("SELECT * INTO " + _newName + " FROM " + _oldName + ")", clsDatabase.Connection);
  2. 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!
Aug 6 '07 #1
1 2400
Rabbit
12,516 Recognized Expert Moderator MVP
Hey! 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:

Expand|Select|Wrap|Line Numbers
  1. OleDbCommand CMD = new OleDbCommand("SELECT * INTO " + _newName + " FROM " + _oldName + ")", clsDatabase.Connection);
  2. 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!
Expand|Select|Wrap|Line Numbers
  1. OleDbCommand CMD = new OleDbCommand("SELECT * INTO " + _newName + " FROM " + _oldName + ";", clsDatabase.Connection);
  2. CMD.ExecuteNonQuery();
Aug 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steve Claflin | last post by:
I have a database with a moderate number of records in several tables (the biggest table at the moment is about 800 records). In development it got moved between 2K and XP repeatedly. Several...
20
by: John | last post by:
Hi, I've recently upgraded from Access 97 to Access 2002 & the performance basically stinks. I have tried the following items listed below but it has only had a minor impact: 1) Upgraded Jet...
2
by: John C | last post by:
I am trying to develop a access database version 2002 from scratch and I am a novice programmer and need much direction. I have been researching and studying about relational database design and...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
9
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access...
70
by: Neil Ginsberg | last post by:
Does anyone know if a new version of Access is due to come out anytime soon? Thanks, Neil
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
10
by: Walshi | last post by:
Hi all, I'm a relative newby to access and VBA etc. My forms and tables etc are working great and saving lots of time...However... I have two databases with the exact same table format. I want...
0
by: cbbibleboy | last post by:
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.