Delphi - AGREGAR EN UN EDIT COMPARAMETROS

 
Vista:

AGREGAR EN UN EDIT COMPARAMETROS

Publicado por MARIA (50 intervenciones) el 13/11/2009 15:54:27
HOLA CHICOS FIGENSE KE TENGO PROBLEMAS POR QUE ESTE ES EL SIGUIENTE CODIGO
query1.sql.clear;
Query1.SQL.Add('select * from BUSUARIO WHERE NOMBRE = : NOMBRE AND CONTRASENA = : CONTRASENA ');
query1.ParamByName('nombre').AsString;
query1.ParamByName('contrasena').AsString;
Query1.Open;
if query1.IsEmpty then begin
query2.SQL.Text:='INSERT INTO BUSUARIO (NOMBRE,NOMBRE_COMPLETO,CONTRASENA,NORMAL,ADMIN) VALUES('+ QuotedStr(Edit1.Text) +','+ QuotedStr(Edit2.Text)+','+ QuotedStr(Edit3.Text)+','+ QuotedStr(Edit4.Text)+','+ QuotedStr(edit5.Text)+')';
end else begin
showmessage('Ya existe');

DICE CUANDO LO COMPILO QUERY1: PARAMETER 'nombre' not found osea no lo encuentra alo mejor tengo problemas en acces por que keria meterle algo y me mandaba error ¿A que se debe esos problemas?
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:AGREGAR EN UN EDIT COMPARAMETROS

Publicado por pilotoasc (1 intervención) el 17/11/2009 20:49:33
lo que pasa es que debe estar igual escrito como lo mandas y como lo esives a parte de uq e te faltta manderle la informacion que va a tener query1.ParamByName('contrasena').AsString.value:= edit.text
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:AGREGAR EN UN EDIT COMPARAMETROS

Publicado por skull leader (80 intervenciones) el 24/11/2009 19:01:37
bueno, primero, Maria, tienes:

query1.sql.clear;
Query1.SQL.Add('select * from BUSUARIO WHERE NOMBRE = : NOMBRE AND CONTRASENA = : CONTRASENA ');
query1.ParamByName('nombre').AsString;
query1.ParamByName('contrasena').AsString;
Query1.Open;
if query1.IsEmpty then begin
query2.SQL.Text:='INSERT INTO BUSUARIO (NOMBRE,NOMBRE_COMPLETO,CONTRASENA,NORMAL,ADMIN) VALUES('+ QuotedStr(Edit1.Text) +','+ QuotedStr(Edit2.Text)+','+ QuotedStr(Edit3.Text)+','+ QuotedStr(Edit4.Text)+','+ QuotedStr(edit5.Text)+')';
end else begin
showmessage('Ya existe');

nota que en tu select, tienes : NOMBRE en vez de :NOMBRE, hay un espacio de separación.

segundo, pilotoasc, no necesitas .value, con .AsString basta.

creo que esto ya quedo resuelto, pero me gusta meter mi cuchara donde no me llaman lol!

saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar