D
DJoe
You cannot insert into two tables at teh same time.
Here is the way you would do it assuming there is a one-to-
many
relationship between the VisiterInfo table and the [User
Log] table
and the fields listed are correct for the given tables.
INSERT INTO
(
[Visiter ID],
[Visiter Name],
[Visit Number],
)
VALUES(@VisID,@VisName, @VisNum
INSERT INTO [User Log]
(
[Visiter ID],
[Referer],
[IP],
[Date],
[Time],
[Entry Page]
)
VALUES(@VisID, @Ref, @IP, @Date, @Time, @EntryPage)
Here is the way you would do it assuming there is a one-to-
many
relationship between the VisiterInfo table and the [User
Log] table
and the fields listed are correct for the given tables.
INSERT INTO
(
[Visiter ID],
[Visiter Name],
[Visit Number],
)
VALUES(@VisID,@VisName, @VisNum
INSERT INTO [User Log]
(
[Visiter ID],
[Referer],
[IP],
[Date],
[Time],
[Entry Page]
)
VALUES(@VisID, @Ref, @IP, @Date, @Time, @EntryPage)
([VisiterInfo.Visiter ID], [User-----Original Message-----
Im an ASP.Net programmer and my SQL skills arnt that great but I need to use
some for data manipulation in my ASP.net applications.
I have the query "SELECT * FROM [User Log] RIGHT JOIN VisiterInfo ON [User
Log].[Visiter ID]=VisiterInfo.[Visiter ID]" which I use to select data from
two tables to display on screen. I use an Access file with an OleDb
connection.
I need to be able to insert rows into this query so that both tables are
updated but I cant figure it out I have try tried the sql below plus many
other alterations of it but cant get it to work. Does anyone have any
Ideas?
"INSERT INTO SELECT * FROM [User Log] RIGHT JOIN VisiterInfo ON [User
Log].[Visiter ID]=VisiterInfo.[Visiter ID]
Log.Visiter ID], [Visiter Name], [Visit Number], [Referer], [IP], [Date],
[Time], [Entry Page]) VALUES (@VisID, @UVisID, @VisName, @VisNum, @Ref, @IP,
@Date, @Time, @EntryPage)"
.