Federico Balbi wrote:
> > /* the insert statement */
> > sprintf(query,"INSERT INTO prob_entry VALUES
> > (%d,'%s','%s','%s','%s','%s','%s','%s','%s','%s')",
> > problem.prob_num,
> > problem.prob_desc,
> > problem.prob_type,
> > problem.username,
> > problem.useremail,
> > problem.telephone,
> > problem.timeentered,
> > problem.closed,
> > problem.prob_user,
> > problem.prob_short_desc);
> >
> > rc = SQLExecDirect(hstmt, query , SQL_NTS);
> > check_return (rc, henv, hdbc, hstmt);
> > <end snip>
>
> Hi, I use VisualC++ and MySQL and upto now did not have problems.
> did you try to make a query manually and see what happens?
> try build the final string without sprint and see what happens...
> sometimes (",',%) act weird in MySQL.
It is wise to not assume the table will always have the columns in the same
order. Change your query to this (assuming your column names are the same
as the fields in your structure):
sprintf(query,"INSERT INTO prob_entry (prob_num, prob_desc, prob_type,
username, useremail, telephone, timeentered, closed, prob_user,
prob_short_desc) VALUES (%d,'%s','%s','%s','%s','%s','%s','%s','%s','%s')",
--
Steven Schoch
StarNet Communications Corp.
1270 Oakmead Pkwy. #301
Sunnyvale, CA 94086 +1 408 739-0881