Sample Header Ad - 728x90

What is MS Access ODBC SQL syntax for a table with AutoIncrement and Memo columns?

1 vote
1 answer
272 views
I am migrating a full framework .NET app to core. It used ADOX to create an MS Access database and tables. It used OLE DB to populate data. In ADOX, the data type was ADOX.DataTypeEnum.adInteger and the syntax from c# was: fld.Properties["Autoincrement"].Value = true; fld.Properties["Seed"].Value = 1; fld.Properties["Increment"].Value = 1; For memo, ADOX data type was ADOX.DataTypeEnum.adLongVarWChar. Since we can no longer use ADOX under .NET Core, I have to use SQL DML through ODBC. When I attempt to create a table using syntax similar to create table t ( col1 int not null identity(1,1), col2 varchar(512) ) I get a syntax error. When I try to adjust this for Access according to this and other related articles in the same documentation tree, I also get syntax error. create table t ( col1 counter, col2 text ) What is the correct syntax for these columns that is compatible with .NET Core and MS Access ODBC driver?
Asked by Gandon Jank (37 rep)
Dec 28, 2020, 08:02 PM
Last activity: May 14, 2025, 12:02 PM