I have an insert query that reqires a lot of variables. My Problem is after I define the fields then all the values, the last value has to be a where so I insert into the correct record. I am sure this is something that I have just been staring at for too long. Here is paart of the code:
INSERT INTO MainInput () VALUES (@cty, @st,@gen,@whe,@did,@bad,@rec,@che,@alc,@par,@bar,@dru,@rom,@unR,@car,@hon,@rUs,@bat,@nim,@toy,@por,@sup,@lab,@fli,@crim,@jus,@nee,@nig,@jea,@ang,@pos,@sug,@chi,@opp,@cut,@pda,@com,@vin,@lia,@dam) where ID = (@lbl)"
cmd.Parameters.AddWithValue("@dam", Data.SqlDbType.Int).Value = Me.cbDamagedGoods.Checked
cmd.Parameters.AddWithValue("@lbl", Data.SqlDbType.Int).Value = Me.tbID.Text
How do I get the last part of that insert correct it is failing on the where clause, I removed the fields as to not make this a 8 page psot.
Thanks in advance team!