HEllo All,
I am trying to insert records into a database using an ADOCommand component but I seem to be having a few problems. I have created all the insert parameters using the Object Inspector but I have chosen to assign the CommandText (SQL INSERT statement) at runtime as well as the values of the parameters. I have left ParamCheck as FALSE in the Object inspector. In the CommandText Property I referenced the parameters using the '
aram' syntax as shown below. However, when the command is executed I get an Access Violation Error. Is there something I am missing?
Parameters[0].Value := StrToFloat(ParamArray[0]);
Parameters[1].Value := StrToFloat(ParamArray[1]);
Parameters[2].Value := ParamArray[2];
Parameters[3].Value := ParamArray[3];
Parameters[4].Value := StrToInt(ParamArray[4]);
Parameters[5].Value := StrToInt(ParamArray[5]);
Parameters[6].Value := ParamArray[6];
Parameters[7].Value := StrToInt(ParamArray[7]);
Parameters[8].Value := StrToFloat(ParamArray[8]);
Parameters[9].Value := ParamArray[9];
Parameters[10].Value :=ParamArray[10];
Parameters[11].Value := StrToFloat(ParamArray[11]);
Parameters[12].Value := StrToInt(ParamArray[12]);
Parameters[13].Value := StrToInt(ParamArray[13]);
Parameters[14].Value := StrToFloat(ParamArray[14]);
Parameters[15].Value := StrToFloat(ParamArray[15]);
Parameters[16].Value := StrToFloat(ParamArray[16]);
CommandText := 'INSERT INTO ARIBH (CNTBTCH,CNTITEM,IDCUST,IDINVC,TEXTTRX,'
+'IDTRX,INVCDESC,SWPRTINVC,DATEINVC, CODECURN,TERMCODE,'
+'DATEDUE,SWTAXBL,TAXSTTS1,BASETAX1,AMTTXBL,AMTINVCTOT) '
+'VALUES
@CNTBTCH,
CNTITEM,
IDCUST,
IDINVC,
TEXTTRX,'
+'
IDTRX,
INVCDESC,
SWPRTINVC,
DATEINVC,
CODECURN,
TERMCODE,'
+'
DATEDUE,
SWTAXBL,
TAXSTTS1,
BASETAX1,
AMTTXBL,
AMTINVCTOT)';
Thanks
Liam
I am trying to insert records into a database using an ADOCommand component but I seem to be having a few problems. I have created all the insert parameters using the Object Inspector but I have chosen to assign the CommandText (SQL INSERT statement) at runtime as well as the values of the parameters. I have left ParamCheck as FALSE in the Object inspector. In the CommandText Property I referenced the parameters using the '
Parameters[0].Value := StrToFloat(ParamArray[0]);
Parameters[1].Value := StrToFloat(ParamArray[1]);
Parameters[2].Value := ParamArray[2];
Parameters[3].Value := ParamArray[3];
Parameters[4].Value := StrToInt(ParamArray[4]);
Parameters[5].Value := StrToInt(ParamArray[5]);
Parameters[6].Value := ParamArray[6];
Parameters[7].Value := StrToInt(ParamArray[7]);
Parameters[8].Value := StrToFloat(ParamArray[8]);
Parameters[9].Value := ParamArray[9];
Parameters[10].Value :=ParamArray[10];
Parameters[11].Value := StrToFloat(ParamArray[11]);
Parameters[12].Value := StrToInt(ParamArray[12]);
Parameters[13].Value := StrToInt(ParamArray[13]);
Parameters[14].Value := StrToFloat(ParamArray[14]);
Parameters[15].Value := StrToFloat(ParamArray[15]);
Parameters[16].Value := StrToFloat(ParamArray[16]);
CommandText := 'INSERT INTO ARIBH (CNTBTCH,CNTITEM,IDCUST,IDINVC,TEXTTRX,'
+'IDTRX,INVCDESC,SWPRTINVC,DATEINVC, CODECURN,TERMCODE,'
+'DATEDUE,SWTAXBL,TAXSTTS1,BASETAX1,AMTTXBL,AMTINVCTOT) '
+'VALUES
+'
+'
Thanks
Liam