parameter missing in statement

parameter missing in statement

Postby pfpc » Fri 05 Aug 2005 10:03

I am currently using mySQLDirect (registered copy)
The first time I used it in a Insetstatment it works fine

But now when I set up the dataadapter to use an Insert statement it keeps coming up with the same invalidoperationException
where it give the first insert field is follows

INSERT
mySqlInsertCommandGrantDaysInLieu.CommandText = "INSERT INTO attendance_Days(LoggedBy, LoggedDate, FFNumber, DIL, Holiday) VALUES ('id12345', 04/08/2005, 'id23456', 25/11/2005, 'Bankholiday')"

DATAADAPTER
in the dataadapter I have configured it with the command
INSERT INTO attendance_DaysInLieu(LoggedBy, LoggedDate, FFNumber, DIL, Holiday) VALUES (:LoggedBy, :LoggedDate, :FFNumber, :DIL, :Holiday)

Yet if I cope the above insert statement directly into mySQL it works perfectly

If you need any more information let me know

Thanks
pfpc
 

parameter is missing at statement

Postby Guest » Fri 05 Aug 2005 12:04

I am currently using mySQLDirect (registered copy)
The first time I used it in a Insetstatment it works fine

But now when I set up the dataadapter to use an Insert statement it keeps coming up with the same invalidoperationException
where it give the first insert field is follows

LoggedBy parameter is missing at statement
If I delete this field (the first one) it comes back with the same error for the next field
LoggedDate parameter is missing at statement

I am getting this error also in delete statements which work fine when transferred directly to mySQL

Yet the SELECT statement all seem to work fine


INSERT
mySqlInsertCommandGrantDaysInLieu.CommandText = "INSERT INTO attendance_Days(LoggedBy, LoggedDate, FFNumber, DIL, Holiday) VALUES ('id12345', 04/08/2005, 'id23456', 25/11/2005, 'Bankholiday')"

DATAADAPTER
in the dataadapter I have configured it with the command
INSERT INTO attendance_DaysInLieu(LoggedBy, LoggedDate, FFNumber, DIL, Holiday) VALUES (:LoggedBy, :LoggedDate, :FFNumber, :DIL, :Holiday)

Yet if I cope the above insert statement directly into mySQL it works perfectly

If you need any more information let me know

Thanks
Guest
 

Postby Oleg » Mon 08 Aug 2005 09:32

What does this code mean in your example:
INSERT
mySqlInsertCommandGrantDaysInLieu.CommandText = "INSERT INTO attendance_Days(LoggedBy, LoggedDate, FFNumber, DIL, Holiday) VALUES ('id12345', 04/08/2005, 'id23456', 25/11/2005, 'Bankholiday')"

It results in the error you described if you place it somewhere in your application because the code does not contain parameters. Take a look at our sample project DataSet that demonstrates work with DataAdapter and read article "Using Parameters".
Oleg
Devart Team
 
Posts: 264
Joined: Thu 28 Oct 2004 13:56


Return to dotConnect for MySQL