Can anyone help me with how to use the line continuation with an INSERT Command please. This is my code:
objCommand.CommandText = "INSERT INTO CollectionForm" & _
"(Region,District,Circuit,AcademicYear,Term,NameOfSchool,SchoolCode,Stream,Shift,DateOf,OpeningDays,InstructionalDays,EnrolKg1Boys)" & _
"(EnrolKg1Girls,TotalKg1Enrol,EnrolKg2Boys,EnrolKg2Girls,TotalKg2Enrol,EnrolP1Boys,EnrolP1Girls,TotalP1Enrol,EnrolP2Boys)" & _
"(EnrolP2Girls,TotalP2Enrol,EnrolP3Boys,EnrolP3Girls,TotalP3Enrol,EnrolP4Boys,EnrolP4Girls,TotalP4Enrol,EnrolP5Boys,EnrolP5Girls)" & _
"(TotalP5Enrol,EnrolP6Boys,EnrolP6Girls,TotalP6Enrol,EnrolJHS1Boys,EnrolJHS1Girls,TotalJHS1,EnrolJHS2Boys,EnrolJHS2Girls)" & _
"(TotalJHS2,EnrolJHS3Boys,EnrolJHS3Girls,TotalJHS3)" & _
"VALUES(@Region,@District,@Circuit,@AcademicYear,@term,@nameOf,@SchoolCode,@Stream,@shift,@Date,@OpeningDays,@InstructionalDays)" & _
"(@Kg1B,@Kg1G,@TotalKg1,@kg2b,@kg2g,@totalkg2,@p1b,@p1g,@totalp1,@p2b,@p2g,@totalp2,@p3b,@p3g,@totalp3,@p4b,@p4g,@totalp4,@p5b,@p5g,)" & _
"(@totalp5,@p6b,@p6g,@totalp6,@jhs1b,@jhs1g,@totaljhs1,@jhs2b,@jhs2g,@totaljhs2,@jhs3b,@jhs3g,@totaljhs3)"
'Inserts Data Parameters
objCommand.Parameters.AddWithValue("@Region", TextBox1.Text)
objCommand.Parameters.AddWithValue("@District", TextBox2.Text)
objCommand.Parameters.AddWithValue("@Circuit", CircuitTextbox.Text)
objCommand.Parameters.AddWithValue("@AcademicYear", ComboBox1.Text)
objCommand.Parameters.AddWithValue("@Term", TextBox48.Text)
objCommand.Parameters.AddWithValue("@nameOf", TextBox3.Text)
objCommand.Parameters.AddWithValue("@SchoolCode", TextBox4.Text)
objCommand.Parameters.AddWithValue("@Stream", TextBox50.Text)
objCommand.Parameters.AddWithValue("@Shift", TextBox49.Text)
objCommand.Parameters.AddWithValue("@Date", DateTimePicker1.Value.Date)
objCommand.Parameters.AddWithValue("@OpeningDays", TextBox51.Text)
objCommand.Parameters.AddWithValue("@InstructionalDays", TextBox52.Text)
objCommand.Parameters.AddWithValue("@Kg1b", TextBox5.Text)
objCommand.Parameters.AddWithValue("@Kg1g", TextBox28.Text)
objCommand.Parameters.AddWithValue("@totalkg1", TextBox40.Text)
objCommand.Parameters.AddWithValue("@Kg2b", TextBox6.Text)
objCommand.Parameters.AddWithValue("@Kg2g", TextBox27.Text)
objCommand.Parameters.AddWithValue("@TotalKg2", TextBox39.Text)
objCommand.Parameters.AddWithValue("@P1b", TextBox7.Text)
objCommand.Parameters.AddWithValue("@P1g", TextBox26.Text)
objCommand.Parameters.AddWithValue("@TotalP1", TextBox38.Text)
objCommand.Parameters.AddWithValue("@P2b", TextBox8.Text)
objCommand.Parameters.AddWithValue("@P2g", TextBox25.Text)
objCommand.Parameters.AddWithValue("@TotalP2", TextBox37.Text)
objCommand.Parameters.AddWithValue("@P3b", TextBox9.Text)
objCommand.Parameters.AddWithValue("@P3g", TextBox24.Text)
objCommand.Parameters.AddWithValue("@TotalP3", TextBox36.Text)
objCommand.Parameters.AddWithValue("@P4b", TextBox10.Text)
objCommand.Parameters.AddWithValue("@P4g", TextBox23.Text)
objCommand.Parameters.AddWithValue("@TotalP4", TextBox35.Text)
objCommand.Parameters.AddWithValue("@P5b", TextBox11.Text)
objCommand.Parameters.AddWithValue("@P5g", TextBox22.Text)
objCommand.Parameters.AddWithValue("@TotalP5", TextBox34.Text)
objCommand.Parameters.AddWithValue("@P6b", TextBox12.Text)
objCommand.Parameters.AddWithValue("@P6g", TextBox21.Text)
objCommand.Parameters.AddWithValue("@TotalP6", TextBox33.Text)
objCommand.Parameters.AddWithValue("@JHS1b", TextBox13.Text)
objCommand.Parameters.AddWithValue("@JHS1g", TextBox20.Text)
objCommand.Parameters.AddWithValue("@TotalJHS1", TextBox32.Text)
objCommand.Parameters.AddWithValue("@jhs2b", TextBox14.Text)
objCommand.Parameters.AddWithValue("@jhs2g", TextBox19.Text)
objCommand.Parameters.AddWithValue("@totaljhs2", TextBox31.Text)
objCommand.Parameters.AddWithValue("@jhs3b", TextBox15.Text)
objCommand.Parameters.AddWithValue("@jhs3g", TextBox18.Text)
objCommand.Parameters.AddWithValue("@totaljhs3", TextBox30.Text)
objConnection.Open()
objCommand.ExecuteNonQuery()
FillDatagrid()
objCommand.CommandText = "INSERT INTO CollectionForm" & _
"(Region,District,Circuit,AcademicYear,Term,NameOfSchool,SchoolCode,Stream,Shift,DateOf,OpeningDays,InstructionalDays,EnrolKg1Boys)" & _
"(EnrolKg1Girls,TotalKg1Enrol,EnrolKg2Boys,EnrolKg2Girls,TotalKg2Enrol,EnrolP1Boys,EnrolP1Girls,TotalP1Enrol,EnrolP2Boys)" & _
"(EnrolP2Girls,TotalP2Enrol,EnrolP3Boys,EnrolP3Girls,TotalP3Enrol,EnrolP4Boys,EnrolP4Girls,TotalP4Enrol,EnrolP5Boys,EnrolP5Girls)" & _
"(TotalP5Enrol,EnrolP6Boys,EnrolP6Girls,TotalP6Enrol,EnrolJHS1Boys,EnrolJHS1Girls,TotalJHS1,EnrolJHS2Boys,EnrolJHS2Girls)" & _
"(TotalJHS2,EnrolJHS3Boys,EnrolJHS3Girls,TotalJHS3)" & _
"VALUES(@Region,@District,@Circuit,@AcademicYear,@term,@nameOf,@SchoolCode,@Stream,@shift,@Date,@OpeningDays,@InstructionalDays)" & _
"(@Kg1B,@Kg1G,@TotalKg1,@kg2b,@kg2g,@totalkg2,@p1b,@p1g,@totalp1,@p2b,@p2g,@totalp2,@p3b,@p3g,@totalp3,@p4b,@p4g,@totalp4,@p5b,@p5g,)" & _
"(@totalp5,@p6b,@p6g,@totalp6,@jhs1b,@jhs1g,@totaljhs1,@jhs2b,@jhs2g,@totaljhs2,@jhs3b,@jhs3g,@totaljhs3)"
'Inserts Data Parameters
objCommand.Parameters.AddWithValue("@Region", TextBox1.Text)
objCommand.Parameters.AddWithValue("@District", TextBox2.Text)
objCommand.Parameters.AddWithValue("@Circuit", CircuitTextbox.Text)
objCommand.Parameters.AddWithValue("@AcademicYear", ComboBox1.Text)
objCommand.Parameters.AddWithValue("@Term", TextBox48.Text)
objCommand.Parameters.AddWithValue("@nameOf", TextBox3.Text)
objCommand.Parameters.AddWithValue("@SchoolCode", TextBox4.Text)
objCommand.Parameters.AddWithValue("@Stream", TextBox50.Text)
objCommand.Parameters.AddWithValue("@Shift", TextBox49.Text)
objCommand.Parameters.AddWithValue("@Date", DateTimePicker1.Value.Date)
objCommand.Parameters.AddWithValue("@OpeningDays", TextBox51.Text)
objCommand.Parameters.AddWithValue("@InstructionalDays", TextBox52.Text)
objCommand.Parameters.AddWithValue("@Kg1b", TextBox5.Text)
objCommand.Parameters.AddWithValue("@Kg1g", TextBox28.Text)
objCommand.Parameters.AddWithValue("@totalkg1", TextBox40.Text)
objCommand.Parameters.AddWithValue("@Kg2b", TextBox6.Text)
objCommand.Parameters.AddWithValue("@Kg2g", TextBox27.Text)
objCommand.Parameters.AddWithValue("@TotalKg2", TextBox39.Text)
objCommand.Parameters.AddWithValue("@P1b", TextBox7.Text)
objCommand.Parameters.AddWithValue("@P1g", TextBox26.Text)
objCommand.Parameters.AddWithValue("@TotalP1", TextBox38.Text)
objCommand.Parameters.AddWithValue("@P2b", TextBox8.Text)
objCommand.Parameters.AddWithValue("@P2g", TextBox25.Text)
objCommand.Parameters.AddWithValue("@TotalP2", TextBox37.Text)
objCommand.Parameters.AddWithValue("@P3b", TextBox9.Text)
objCommand.Parameters.AddWithValue("@P3g", TextBox24.Text)
objCommand.Parameters.AddWithValue("@TotalP3", TextBox36.Text)
objCommand.Parameters.AddWithValue("@P4b", TextBox10.Text)
objCommand.Parameters.AddWithValue("@P4g", TextBox23.Text)
objCommand.Parameters.AddWithValue("@TotalP4", TextBox35.Text)
objCommand.Parameters.AddWithValue("@P5b", TextBox11.Text)
objCommand.Parameters.AddWithValue("@P5g", TextBox22.Text)
objCommand.Parameters.AddWithValue("@TotalP5", TextBox34.Text)
objCommand.Parameters.AddWithValue("@P6b", TextBox12.Text)
objCommand.Parameters.AddWithValue("@P6g", TextBox21.Text)
objCommand.Parameters.AddWithValue("@TotalP6", TextBox33.Text)
objCommand.Parameters.AddWithValue("@JHS1b", TextBox13.Text)
objCommand.Parameters.AddWithValue("@JHS1g", TextBox20.Text)
objCommand.Parameters.AddWithValue("@TotalJHS1", TextBox32.Text)
objCommand.Parameters.AddWithValue("@jhs2b", TextBox14.Text)
objCommand.Parameters.AddWithValue("@jhs2g", TextBox19.Text)
objCommand.Parameters.AddWithValue("@totaljhs2", TextBox31.Text)
objCommand.Parameters.AddWithValue("@jhs3b", TextBox15.Text)
objCommand.Parameters.AddWithValue("@jhs3g", TextBox18.Text)
objCommand.Parameters.AddWithValue("@totaljhs3", TextBox30.Text)
objConnection.Open()
objCommand.ExecuteNonQuery()
FillDatagrid()