Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with OleDB Create Table command

Status
Not open for further replies.

Fifer74

Programmer
Feb 25, 2003
12
0
0
GB
Hi

I am attempting to create a table within an access database with the table name taken from an input box. However an error is raied when I enter the word 'on' as the table name. I assume that this is a reserved keyword and cannot be used, but does anyone know what other words cannot be used so that I can filter them out ?

Here is the code I am using :

Dim sNewTable1 As String
sNewTable1 = "CREATE TABLE " & sNewName
sNewTable1 &= " (ID INT, "
sNewTable1 &= "UnitName VARCHAR(50), "
sNewTable1 &= "ItemName VARCHAR(50), "
sNewTable1 &= "InstructorSetting VARCHAR(50), "
sNewTable1 &= "PRIMARY KEY (ID))"
oDbCommand = New System.Data.OleDb.OleDbCommand(sNewTable1)
oDbCommand.Connection = oDbConn
oDbCommand.ExecuteNonQuery()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top