我用了下面的语句:
StudentQuery.Close;
StudentQuery.SQL.Clear;
StudentQuery.ExecSQL;
StudentQuery.Close;
StudentQuery.Open;
运行出错,不知道为什么?
StudentQuery.Close;
StudentQuery.SQL.Clear;
StudentQuery.ExecSQL;
StudentQuery.Close;
StudentQuery.Open;
运行出错,不知道为什么?
StudentQuery.Close;
StudentQuery.SQL.Clear;
StudentQuery.ExecSQL;
StudentQuery.Close;
StudentQuery.Open;
你把SQL语句都清除了,怎么会不出错?
StudentQuery.Close;
StudentQuery.SQL.Clear;
StudentQuery.SQL.Text := 'Insert into table1(field1)values(1)';
StudentQuery.ExecSQL;
StudentQuery.Close;
StudentQuery.SQL.TEXT := 'select * from table1 where field1=1';
StudentQuery.Open;写上SQL语句之后才不会出错
StudentQuery.ExecSQL; //楼主的目的是什么?
至于能不能ExecSQL就不清楚了
StudentQuery.SQL.Clear;
StudentQuery.SQL.Text:='Insert语句';
StudentQuery.ExecSQL;
StudentQuery.Close;
StudentQuery.Open;
这样执行就不会错了,你没有SQL语句执行StudentQuery.ExecSQL;这句干什么.
ADOQuery1.Open;//执行查询类的SQL语句
ADOQuery1.ExecSQL;//执行更新类的SQL语句
delete等SQL语句的执行,没有返回一个光标。你可以在SQL用参数啦。这是我近来写的数据库的登录语句。
checkpassword.Close;
checkpassword.SQL.Clear ;
checkpassword.SQL.Add('select * from LoginPersonnel ');
checkpassword.SQL.Add(' where LoginPersonnel=:LoginPersonnel and PassWords=:PassWords');
checkpassword.Params[0].AsString:=cb_uesr.Text;
checkpassword.Params[1].AsString:=passwords.Text;
checkpassword.open;
写上SQL语句就KO了