Avatar of jjc9809
jjc9809
 asked on

Insert Error Still

I have an error when the Insert is read:

My coding:  Dim strQuery As String = "Insert Into [PersonOfInterest] ([PK_DriverLicenseID_vch], [IssuingState_vch], [Priority_vch], [FirstName_vch], [MiddleInitial_vch], [LastName_vch], [FK_Suffix_ID_vch], [PhysicalAddress1_vch], [PhysicalAddress2_vch], [PhysicalCity_vch], [FK_CountyID_vch], [FK_PhysicalState_vch], [PhysicalZip_ch], [DOBMonth_ch], [DOBDay_ch], [DOBYear_ch], [SSN1_ch], [SSN2_ch], [SSN3_ch], [FK_RaceID_vch], [HeightFt_ch], [HeightIn_ch], [FK_HairColor_vch], [FK_EyeColor_vch], [Employer_vch], [EmployerAddress_vch], [EmployerCity_vch], [EmployerState_vch], [EmployerZip_ch], [SchoolAttending_vch], [SchoolAddress_vch], [SchoolCity_vch], [SchoolState_vch], [SchoolZip_ch], [HomePhone1_ch], [HomePhone2_ch], [HomePhone3_ch], [MobilePhone1_ch], [MobilePhone2_ch], [MobilePhone3_ch], [OtherPhone1_ch], [OtherPhone2_ch], [OtherPhone3_ch], [FBINumber_vch], [Alias1_vch], [Alias2_vch], [Alias3_vch], [Alias4_vch], [Alias5_vch], [FK_IntelligenceType_vch], [ContactMonth_ch], [ContactDay_ch], [ContactYear_ch], [DateTimeAdded_vch], [UserAdded_vch], [DateTimeModified_vch], [UserModified_vch], [Weight_ch]) VALUES (@PK_DriverLicenseID_vch, @IssuingState_vch, @Priority_vch, @PhysicalCity_vch, @FK_CountyID_vch, @FK_PhysicalState_vch, @PhysicalZip_ch, @DOBMonth_ch, @DOBDay_ch], @DOBYear_ch, @SSN1_ch, @SSN2_ch, @SSN3_ch, @FK_RaceID_vch, @HeightFt_ch, @HeightIn_ch , @FK_HairColor_vch, @FK_EyeColor_vch, @Employer_vch, @EmployerAddress_vch, @EmployerCity_vch , @EmployerState_vch, @EmployerZip_ch, @SchoolAttending_vch, @SchoolAddress_vch, @SchoolCity_vch, @SchoolState_vch, @SchoolZip_ch, @HomePhone1_ch, @HomePhone2_ch, @HomePhone3_ch, @MobilePhone1_ch, @MobilePhone2_ch, @MobilePhone3_ch, @OtherPhone1_ch, @OtherPhone2_ch, @OtherPhone3_ch, @FBINumber_vch, @Alias1_vch, @Alias2_vch, @Alias3_vch, @Alias4_vch, @Alias5_vch, @FK_IntelligenceType_vch, @ContactMonth_ch, @ContactDay_ch, @ContactYear_ch, @FirstName_vch, @MiddleInitial_vch, @LastName_vch, @FK_Suffix_ID_vch, @PhysicalAddress1_vch, @PhysicalAddress2_vch, @DateTimeAdded_vch, @UserAdded_vch, @DateTimeModified_vch, @UserModified_vch, @Weight_ch); SELECT SCOPE_IDENTITY();"


The error appears on this coding and stops:

'Open the connection
        myConnection.Open()

        'Execute the query
        IntID = Convert.ToInt32(myCommand.ExecuteScalar())

        'Brings the ID Field in
        Me.ID.Text = IntID
        QueryResult.Text = "Record '" + IntID.ToString() + "' was saved successfully!"


There is an incorrect syntax on "]"

I can't see the problem.

jjc9809
Visual Basic.NET

Avatar of undefined
Last Comment
PaulHews

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
PaulHews

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
PaulHews

Here it is in original format:

Dim strQuery As String = "Insert Into [PersonOfInterest] ( [Alias1_vch], [Alias2_vch], [Alias3_vch], [Alias4_vch], [Alias5_vch], [ContactDay_ch], [ContactMonth_ch], [ContactYear_ch], [DateTimeAdded_vch], [DateTimeModified_vch], [DOBDay_ch], [DOBMonth_ch], [DOBYear_ch], [Employer_vch], [EmployerAddress_vch], [EmployerCity_vch], [EmployerState_vch], [EmployerZip_ch], [FBINumber_vch], [FirstName_vch], [FK_CountyID_vch], [FK_EyeColor_vch], [FK_HairColor_vch], [FK_IntelligenceType_vch], [FK_PhysicalState_vch], [FK_RaceID_vch], [FK_Suffix_ID_vch], [HeightFt_ch], [HeightIn_ch], [HomePhone1_ch], [HomePhone2_ch], [HomePhone3_ch], [IssuingState_vch], [LastName_vch], [MiddleInitial_vch], [MobilePhone1_ch], [MobilePhone2_ch], [MobilePhone3_ch], [OtherPhone1_ch], [OtherPhone2_ch], [OtherPhone3_ch], [PhysicalAddress1_vch], [PhysicalAddress2_vch], [PhysicalCity_vch], [PhysicalZip_ch], [Priority_vch], [SchoolAddress_vch], [SchoolAttending_vch], [SchoolCity_vch], [SchoolState_vch], [SchoolZip_ch], [SSN1_ch], [SSN2_ch], [SSN3_ch], [UserAdded_vch], [UserModified_vch], [Weight_ch], [PK_DriverLicenseID_vch] ) VALUES ( @Alias1_vch, @Alias2_vch, @Alias3_vch, @Alias4_vch, @Alias5_vch, @ContactDay_ch, @ContactMonth_ch, @ContactYear_ch, @DateTimeAdded_vch, @DateTimeModified_vch, @DOBDay_ch], @DOBMonth_ch, @DOBYear_ch, @Employer_vch, @EmployerAddress_vch, @EmployerCity_vch , @EmployerState_vch, @EmployerZip_ch, @FBINumber_vch, @FirstName_vch, @FK_CountyID_vch, @FK_EyeColor_vch, @FK_HairColor_vch, @FK_IntelligenceType_vch, @FK_PhysicalState_vch, @FK_RaceID_vch, @FK_Suffix_ID_vch, @HeightFt_ch, @HeightIn_ch , @HomePhone1_ch, @HomePhone2_ch, @HomePhone3_ch, @IssuingState_vch, @LastName_vch, @MiddleInitial_vch, @MobilePhone1_ch, @MobilePhone2_ch, @MobilePhone3_ch, @OtherPhone1_ch, @OtherPhone2_ch, @OtherPhone3_ch, @PhysicalAddress1_vch, @PhysicalAddress2_vch, @PhysicalCity_vch, @PhysicalZip_ch, @Priority_vch, @SchoolAddress_vch, @SchoolAttending_vch, @SchoolCity_vch, @SchoolState_vch, @SchoolZip_ch, @SSN1_ch, @SSN2_ch, @SSN3_ch, @UserAdded_vch, @UserModified_vch, @Weight_ch, @PK_DriverLicenseID_vch ); SELECT SCOPE_IDENTITY();"

Open in new window

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy