我這是工作的一個SQL查詢,它插入正確的數據,但該ID的不同步:SQL插入查詢(語法問題)
Dim sql As String = ("INSERT INTO [CANRADcontacts]") & _
(" ([Title], [Initials], [FirstName], [LastName], [Organisation], [Department], [Address], [Code],") & _
(" [Telephone], [WorkTelephone], [Fax], [CellularTelephone],[Email], [ResearchFocus], [CollID], [ResearchFunders])") & _
(" VALUES (@Title, @Initials, @FirstName, @LastName, @Organisation, @Department, @Address, @Code, ") & _
("@Telephone, @WorkTelephone, @Fax, @CellularTelephone, @Email, @ResearchFocus, @CollID, @ResearchFunders); ") & _
("INSERT INTO [CANRADcollreg] ([CollID], [FlightDateArrive], [FlightNameArrive], [FlightTimeArrive], [FlightDateDepart], [FlightNameDepart], [FlightTimeDepart], [AttendingLaunch], [Accomodation], [DietaryRequirements], [SpecificDietaryRequirement]) ") & _
("VALUES (@CollID, @FlightDateArrive, @FlightNameArrive, @FlightTimeArrive, @FlightDateDepart, @FlightNameDepart, @FlightTimeDepart, @AttendingLaunch, @Accomodation, @DietaryRequirements, @SpecificDietaryRequirement)")
在數據庫中,我有兩列(ContactsID在CANRADcollreg和CANRADcontacts上的ID),我需要同步並插入記錄時插入相同的ID。請你能幫助我如何實現這一目標?
感謝和問候。
您使用的數據庫是? – 2010-02-05 08:23:16
MS SQL Server 2008 – Phil 2010-02-05 10:26:15