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()
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()