[Gambas-user] Duplicated invalid record inserting into MySQL

João Luís joao.pinto at ...1959...
Wed Aug 20 12:42:00 CEST 2008


Hello,
I do not use Gambas for a long time so please apologize if  I am doing a
newbie mistake.

I am trying to build a simple test app to insert into a mysql table.
The relevant code:
PUBLIC SUB Button1_Click()
 DIM res AS Result
 DIM sql AS String
 DIM name AS String
 IF TextBox1.Text = ""
  Message.Warning("Please provide a customer name")
  RETURN
 END IF
 sql = "INSERT INTO customer VALUES(name), ('" & TextBox1.Text & "')"
 Message.Info("Inserting")
 res = mDatabase.conn.Exec(sql)
END

However when I check the table contents after a single insert:
mysql> select * from customer;
+-------+
| name  |
+-------+
|       |
| mokar |
+-------+
2 rows in set (0.00 sec)

What am I doing wrong to get that second record ?

Thanks



-- 
João Luís Marques Pinto
GetDeb Project Manager
http://www.getdeb.net
http://blog.getdeb.net



More information about the User mailing list