aisha

Hi,

I have two relational tables in my project, and I have to insert data into both of them at one,, or since the first table was filled,, the second should be too ..

for example I have a book table, and book info table ..
in the book I would have the ISBN, name .. etc ..
book info has FK (ISBN) and other info about the book such as: description, category .....

information about the book are in a text file, I want to extract the information
and have them into two tables with a FK (ISBN) between them ..

can I insert into these two tables at once
if yes, how
if no , what should I do instead

### Re: Visual Basic Express Edition how to insert into 2 tables at once?

pinoyz

there should be 2 different insert command one for booktable and one for bookinfotable....

i hope it helps

### Re: Visual Basic Express Edition how to insert into 2 tables at once?

aisha

sorry because I didn't explain it more,

I have two insert command, but when I put them after each other

I got an error ,,

### Re: Visual Basic Express Edition how to insert into 2 tables at once?

pinoyz

what kind of error

finish first the insert command followed by another insert command

example:

dim sqlinsert as new sqlclient.sqlcommand("insert blah blah")

sqlinsert.connection.open

sqlinsert.executenonquery

sqlinsert.connection.close

dim sqlinsert1 as new sqlclient.sqlcommand("insert blah blah")

sqlinsert1.connection.open

sqlinsert1.executenonquery

sqlinsert1.connection.close