tadoquery

TAdoquery date format

流过昼夜 提交于 2020-01-04 12:50:14
问题 I am Java developer. I have some old program in Delphi. In old version they work with mdb . I fixed it for connection with SQL Server. All SQL queries are implemented with TAdoQuery . qryTemp.SQL.Text:='select sum(iif(ComeSumm>0,comesumm,0)),sum(iif(lostSumm>0,lostsumm,0)) from cash '+ 'where (IdCashClause is null or idcashclause<>8) '+ ' and cashNum='+IntToStr(i)+ ' and CashType=0'+ ' and format(PayDate,"dd/mm/yyyy")=format('''+DateToStr(Date)+''',"dd/mm/yyyy") '; The program throws an

Delphi : Setting OnGetText Event Handler for fields of a dynamic query

折月煮酒 提交于 2020-01-02 03:37:08
问题 I want to set my own procedure to OnGetText event of fields in a dynamic query My procedure is like this : procedure TMainFrm.MyFieldGetText(Sender: TField; var Text: String; DisplayText: Boolean); begin ... end; "...Captions" are String array constants I set the event handler in OnAfterOpen event of ADOQuery : procedure TImportFrm.ADOQueryAfterOpen(DataSet: TDataSet); var I : Integer; begin for I := 0 to ADOQuery.FieldCount - 1 do ADOQuery.Fields[I].OnGetText := MainFrm.MyFieldGetText; end;

Is there a way to know if TAdoQuery in Edit state was changed?

瘦欲@ 提交于 2019-12-23 23:22:49
问题 Is there a way to know if TAdoQuery in Edit state was changed? Assuming we forced it into edit state, and we want to ask the user if he wants to keep the changes. 回答1: You have the TADOQuery.Modified property e.g: if ADOQuery1.State in [dsEdit, dsInsert] and (ADOQuery1.Modified) then if KeepChanges then ADOQuery1.Post else ADOQuery1.Cancel; 来源: https://stackoverflow.com/questions/7792193/is-there-a-way-to-know-if-tadoquery-in-edit-state-was-changed

SQL syntax error

馋奶兔 提交于 2019-12-13 04:38:30
问题 I want to run a simple SQL from Delphi 2007. I use AdoQuery . My table has a column id and data type is int (autoincrement). My question is if I execute select * from comlist there is no problem, it runs. But if I define a field on SQL like select compname from comlist Delphi complains ado:Field 'id' not found The Compname column exist in table. I have the following fields on my table: id int creationdate datetime compid nvarcahr(50) complocation nvarchar(50) serial nvarchar(50) compname

Using ParseSQL Command for ADO Parameters Cause Invalid Parameter DataType

懵懂的女人 提交于 2019-12-12 08:59:21
问题 I have some SQL Command that contains a parameter such:(Note that myID has "int" type in SQL) vSqlString :='Select * From myTable Where myID= :paramID'; and Use ParseSQL Command to execute this command: myADOQuery.Parameters.ParseSQL(vSqlString , True); Now myADOQuery.Parameters.ParamByName('paramID').DataType is smallint Type and it can't accept negative integer values. I can exactly show to compiler that my Parameter[0].DataType is ftIneteger and it works properly, but what is a good

How to insert value into the Excel file using ADO?

房东的猫 提交于 2019-12-12 03:41:55
问题 I'm using the following code to insert value in the Excel file: sAppend:='INSERT INTO ["Excel 8.0;Database=' + Edit1.Text + ';"].[Sheet1$] (d) ' + FormatDateTime('d/m/yyyy', now)+';'; AdoQuery1.SQL.Text:=sAppend; AdoQuery1.ExecSQL; Previous routine is completely shown. Connection to the Excel file procedure TForm1.ConnectToExcel; var strConn : widestring; begin strConn:='Provider=Microsoft.Jet.OLEDB.4.0;' + 'Data Source=' + Edit1.Text + ';' + 'Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"

TADOQuery: 'EDatabaseError type mismatch for field 'MyField', expecting: String actual: FixedWideChar' [closed]

狂风中的少年 提交于 2019-12-11 03:43:47
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I have 3 different databases (development, homolog and prod), each of them in one of the following Oracle versions: 11g and 10g. I'm using a TADOQuery to

TADOQuery Temp Table Lost if it has a parameter in query

我是研究僧i 提交于 2019-12-10 17:18:00
问题 I have a TADOQuery that generates a tempTable if I hard code the "Where parameter, it works fine, but if I use a TADO Parameter the next query doesn't know about the temp table. What am I doing wrong? I wish I could simplify this example but here it is. (SQL Server) CREATE TABLE brFTNode_Children ( pID integer NOT NULL, cID integer NOT NULL, primary key (pID, cID) ); insert into brFTNode_Children values(1,2); insert into brFTNode_Children values(1,3); insert into brFTNode_Children values(3,4)

Delphi Performance: Reading all values under a field in a dataset

牧云@^-^@ 提交于 2019-12-07 02:53:11
问题 We're trying to find out some performance fixes reading from a TADOQuery. Currently, we loop through the records using 'while not Q.eof do begin ... Q.next method. For each, we read ID and Value of each record, and add each to a combobox list. Is there a way to convert all values of a specified field into a list in one shot? Rather than looping through the dataset? It would be really handy if I can do something like... TStrings(MyList).Assign(Q.ValuesOfField['Val']); I know that's not a real

Delphi Performance: Reading all values under a field in a dataset

烂漫一生 提交于 2019-12-05 05:16:53
We're trying to find out some performance fixes reading from a TADOQuery. Currently, we loop through the records using 'while not Q.eof do begin ... Q.next method. For each, we read ID and Value of each record, and add each to a combobox list. Is there a way to convert all values of a specified field into a list in one shot? Rather than looping through the dataset? It would be really handy if I can do something like... TStrings(MyList).Assign(Q.ValuesOfField['Val']); I know that's not a real command, but that's the concept I'm looking for. Looking for a fast response and solution (as always