TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
nett
NA
7
0
multiple sql statements in OLE DB command
Jun 12 2004 3:47 PM
I'm developing a C# application and using OleDb and ADO.NET to access a MS Access database. I'm relatively new at this stuff so I'm probably missing something simple. I would like to create a table and then alter another table to add a field and foreign key constraint. But the command fails when I combine the 2 SQL statements together (CREATE TABLE and ALTER TABLE). Everything works great when 2 commands are used. I've searched through help but can't find anything useful (e.g. command expression syntax). Any suggestions? Here's an example of what I've tried: BEGIN TRANSACTION CREATE TABLE Owners ( OwnerID INTEGER IDENTITY (1,1) NOT NULL, LastName CHAR(40) NULL, FirstName CHAR(40) NULL, CONSTRAINT PK_Owners PRIMARY KEY ( OwnerID ) ) ALTER TABLE Property ADD OwnerID INTEGER NULL, CONSTRAINT FK_Property_Owners FOREIGN KEY ( OwnerID ) REFERENCES Owners ( OwnerID ) COMMIT Thanks, Jerry
Reply
Answers (
1
)
I Couldnt Can U? (Master Detail Relationship)
How to retrieve previous record or next record using MS Access and C#