I'm using VB.NET AND SQL SERVER 2008
I've Array of object that I need to INSERT into SQL SERVER 2008 this is the object
this object will be Inserted in to three tables :
First table will have the report information : [ id ,reportName , description , style ] after inserting this information i'll use the
@@IDENTITYof thisRowasFKfor the second TableSECOND table : [id , id_first_table, comment,complete,finished,name,started,outcome]
Question will come with the third table
How can i loop through the checklist Element and inserting it to the third table using the second table id till the end of element
like :
[id , id_second_table, 101 ,820]
[id , id_second_table'sameid', 101,831]
Here is what i have tried :
DECLARE @reportId INT , @fieldId INT
INSERT INTO
dbo.tblReport(strReportName,strReportDescription,strReportStyle,
strScource,dtmCreated)
VALUES ('caustic' , 'titration caustic', 'simple table' ,'user' , getdate())
SELECT @reportId = @@IDENTITY
INSERT INTO dbo.tblReportFields
(lngReports,strFieldName,bolComment,bolComplete,bolFinished,
bolOutCome,bolStarted,bolUser)
VALUES (@reportId ,'caustic titration' , 1,0,1,0,0,0)
SELECT @fieldId = @@IDENTITY
--LOOP AND INSERT ALL THE checklist Element
INSERT INTO dbo.tblReportTask (lngReportFields,lngChecklist,lngTask)
VALUES (@fieldId, 814 , 1443)
any ideas on the best way of doing this will be also considered