From: <Ars...@bp...> - 2006-03-28 16:53:23
|
Never mind, I put the SQL statement in a MyDB1.Query( and it worked like = a charm... LibSQL is great! Ariel -----Mensaje original----- De: lib...@li... = [mailto:lib...@li...] En nombre de = Ariel S=E1nchez Mora Enviado el: lunes, 27 de marzo de 2006 18:29 Para: lib...@li... Asunto: [libsql] MyDB1.Execute( actually gives me a run time error! I read somewhere if this happens, I'm really doing something wrong. = Using Delphi 7.1, the error is in the attachment. The first row of the = for loop does get inserted, I can see it when I check the table; but = then the runtime error occurs; it even occurs without the for loop. = (only one Execute) This is the routine which generates the error: For fila:=3D0 to StringGrid1.RowCount do begin MyDB1.Execute('insert into lista_oficinas VALUES = (null,"'+StringGrid1.Rows[fila].Strings[0]+'","'+StringGrid1.Rows = [fila].Strings[1]+'","'+StringGrid1.Rows[fila].Strings[2]+'")'); Memo1.Lines.Add('insert into lista_oficinas VALUES = (null,"'+StringGrid1.Rows[fila].Strings[0]+'","'+StringGrid1.Rows = [fila].Strings[1]+'","'+StringGrid1.Rows[fila].Strings[2]+'")'); end; And this is where the debugger takes me: FillFieldInfo (PMYSQL_RES(Result)); FCurrentSet.FColCount :=3D = mf.mysql_num_fields(PMYSQL_RES(Result)); The table's structure is: CREATE TABLE `lista_oficinas` ( = =20 `ID_nombre_oficina` smallint(6) NOT NULL = auto_increment COMMENT 'numero unico para identificar cada oficina', =20 `Nombre_oficina` varchar(40) NOT NULL default '' = COMMENT 'Nombre comun de la oficina', =20 `Region` varchar(20) NOT NULL default '' COMMENT = 'provincia o region segun el BP', =20 `diagrama_oficina` varchar(100) NOT NULL default '' = COMMENT 'diagrama en visio en servidor SAOR', =20 PRIMARY KEY (`ID_nombre_oficina`) = =20 ) ENGINE=3DMyISAM DEFAULT CHARSET=3Dlatin1 And if I only run the Memo1 part and then copy paste the query in the = mysql client, theres no prob mysql> insert into lista_oficinas VALUES (null,"CSF=20 mysql> Alajuela","Alajuela","\\Itin-fps02\subproceso aor\Diagramas de = red\C entros de Servicio Financiero\DG013P1-01.vsd"); Query OK, 1 row affected (0.00 sec) Can anyone direct me in the proper way I should use MyBD1.Execute( ? I = tried with ';' and no ';' at the end (I saw it in an example). I tried = taking away the primary key, cause it was a big deal in dbexpress. I'm = using version .64, and if anyone is interested, i can send you all you = want :) Thanks for your time! I'm the only posting... I bet you think I'm a = nuisance!=20 Rene, I'm not really a sistems engineer, but I'll see what I can do for = you. Ariel |