The design of the 'content' table cannot be modified. It is in a read-only database.

Source: Internet
Author: User
Tags sql error
The table content design cannot be modified. It is in the read-only Database $ db =$ _ SERVER ['document _ root']. "\ myfirst. mdb ";
$ Connstr = "Driver = {Microsoft Access Driver (*. mdb)}; Dbq = $ db ";
$ Connid = odbc_connect ($ connstr, "", "", SQL _CUR_USE_ODBC) or die ("failed to open the database! Contact the administrator ");
Echo 123;
$ SQL = "create table content (id counter constraint primarykey primary key, [title] varchar (50) null, [province/city] varchar (30) null, [content] varchar (255), [acquired] bit, [sent] bit )";
Echo $ SQL;
Odbc_exec ($ connid, $ SQL );
Execution result:
Warning: odbc_exec () [function. odbc-exec]: SQL error: [Microsoft] [ODBC Microsoft Access Driver] the design of the 'content' table cannot be modified. It is in a read-only database ., SQL state 42000 in SQLExecDirect in G: \ zhengli \ access. php on line 9
How to solve the error and successfully create an access table


Reply to discussion (solution)

The design of the 'content' table cannot be modified. It is in a read-only database.

Right. how can I change it? how can I create an access table in php...

The table content already exists. if you create table content again... of course, an error is returned.
Use the ALTER command to modify the table structure.
If you must create a new table, delete the table first (DROP command)

There is no table in the database, and then the Php code is used to create the table. this error is reported... How to change ..

No content table? Insufficient permissions.

Permission ??? What does this mean? how can I create a table successfully after successfully connecting to the access database in php ???

Create an empty database db1 in Access management.
Execute your code

$ Db = realpath ("db1.mdb"); $ connstr = "Driver = {Microsoft Access Driver (*. mdb)}; Dbq = $ db "; $ connid = odbc_connect ($ connstr," "," ", SQL _CUR_USE_ODBC) or die (" failed to open the database! Contact the administrator "); echo 123; $ SQL =" create table content (id counter constraint primarykey primary key, [title] varchar (50) null, [province/city] varchar (30) null, [content] varchar (255), [acquired] bit, [sent] bit) "; echo $ SQL; odbc_exec ($ connid, $ SQL );

Open it in the access manager:

Conclusion I think you have obtained

Well, my code is okay because I didn't set the access database permission, but thanks.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.