I am new to MySQL and have an odd problem of which I am hoping someone can assist. I am attempting to insert data into my db using C++ and the C-API.
The database connects fine, and I can get a select statement to return data, but the insert will not work from the program. I then had the program output the variable that I am using to house the INSERT statement. If I then copy that output and paste it into the query window of mysqlcc, the insert statement processes fine. I am using the same user in the program as I am in mysqlcc. Forgive me for the length, but below are snippets from the program and its output: ------- program source code ------- sprintf(insert_new_tha1_record,"INSERT INTO wfr_map (filename, facility, lot, wafer, repeat_cnt, dte, tme, prog, product, type, prober, tester, probecard,loadboard, operator, temp, fail_cnt, pass_cnt, d_chips, tot_cnt,yield, neff,flat, b_mode, test_var, w_pass,npar,msg,map_type_id,archive) VALUES(\'%s\',\'%s\',\'%s\',\'%s\', \'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\' %s\',\'%s\',\'%s\',NULL,\'%s\', %d,%d,%d,%d,%d,%d,%d,\'%c\',%d,\'%s\',%d,%d,\'%s\',%d,0)",filename, facility,lot_id, wafer_id, repeat_cnt, formatted_date,time_out, prog_id,prod_id, type_id, prober_id,tester_id, probecard, oper_id,temp,fail_cnt, pass_cnt, dble_chips, total_cnt, yield, neff, flat, b_mode, test_var, wafer_pass,npar,msg,tha1_type); conn = mysql_init(NULL); if (conn == NULL) { print_error(conn, "mysql_init() failed. Probably out of memory! " ); exit(1); } if (mysql_real_connect ( conn, my_host_name, my_user_name, my_pwd, my_db_name, my_port_number, my_socket_name, my_flags) == NULL) { print_error(conn, "WMDB connection failed!!! "); mysql_close(conn); exit(1); } if (mysql_query(conn,insert_new_tha1_record) !=0) /*the query failed */ { print_error (conn, "Could not execute query!"); return; } mysql_close(conn); ------------------------------------------ -------- program output -------- INSERT INTO wfr_map (filename, facility, lot, wafer, repeat_cnt, dte, tme, prog, product, type, prober, tester, probecard,loadboard, operator, temp, fail_cnt, pass_cnt, d_chips, tot_cnt,yield, neff,flat, b_mode, test_var, w_pass,npar,msg,map_type_id,archive) VALUES('/data/thx1/inbox/4296381_4.001','XTex6','4296381 ','04',' 0','2004-12-13','23:31:48','Z512X ','Z5127 ','ZZ86129EA ',' 1868 ','219 ','15001-02 ',NULL,'9269 ',-32000,0,0,0,0,0,0,'S',0,' ',1,95,'PT',2,0) Could not execute query! ERROR: 1064(You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'lot, wafer, repeat_cnt,filename from wfr_map' at line 1) ------------------------------------------ Again, If I copy the output of the insert statement above and paste it into the query frame of mysqlcc for this particular table, it processes fine and inserts the data. Anyone able to give me a hint?? -- TIA, Darrell Cormier Registered Linux user #370711 http://counter.li.org -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]