Saving data to 2 tables problem

neoice

New member
Joined
Mar 2, 2009
Messages
2
Programming Experience
Beginner
Hi,

I am using VS 2005 ASP/VB - SQL 2005 website.

I have tested my database by manually typing in data and all appears to be well. However, I cannot work out how to get data into two tables when clicking on the 'submit' button on the webform.

I have a course table called Tblcourse and a code table called Tblcode. As a user can choose more than 1 code, I have created another table to hold this data.

The problem is my code table relies on the courseid from tblcourse which is automatically generated when the record is created in the database.

Tblcourse
CourseID,title,cost,date,staffid,providerid,evaluation,notes,complete,assessment

tblcode
courseid,code,staffid


MyCmd = New SqlCommand("insert into tblcourse(title,cost,date,providerid,staffid,evaluation,assessment,complete,notes) values(@title,@cost,@date,@providerid,@staffid,@evaluation,@assessment,@complete,@notes)", MyConn)

cheers
:)
 

Latest posts

Back
Top