Read Only Table

40 pts.
Tags:
File permissions
Microsoft Access
SQL scripts
SQL Server 2005
I create a table in sql server 2k5, the script is look like this: CREATE TABLE [dbo].[tb1PmtD]( [PmtDLU] [int] NOT NULL, [PmtDInvLU] [int] NOT NULL, [PmtDAmount] [money] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[tb1PmtD] WITH NOCHECK ADD CONSTRAINT [tb1Pmttb1PmtD] FOREIGN KEY([PmtDLU]) REFERENCES [dbo].[tb1Pmt] ([PmtID]) ON UPDATE CASCADE GO ALTER TABLE [dbo].[tb1PmtD] CHECK CONSTRAINT [tb1Pmttb1PmtD] When i open this table in ms access data project, recordset in this table is marked as read-only...can't add records or delete. Please help me, what's wrong with my code.

Answer Wiki

Thanks. We'll let you know when a new response is added.

If I remember my Microsoft Access correctly you have to have a primary key on the table in the SQL Server database for Microsoft Access to be able to write to the table.

Assuming your first column in the primary key the CREATE TABLE command would look something like this.
<pre>
CREATE TABLE [dbo].[tb1PmtD](
[PmtDLU] [int] PRIMARY KEY NOT NULL,
[PmtDInvLU] [int] NOT NULL,
[PmtDAmount] [money] NOT NULL
) ON [PRIMARY]
GO</pre>

You will need to remove the link from the Access database to the SQL Table and recreate it after your recreate the table.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Denny Cherry
    Check out my SQL Server blog "SQL Server with Mr Denny" for more SQL Server information.
    66,010 pointsBadges:
    report
  • Ipong
    Thanks, i got the point. Table in sql server must have an index and unique. I need to restructuring my table now.
    40 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following