

limelect
Members-
Content Count
924 -
Joined
-
Last visited
-
Days Won
1
Everything posted by limelect
-
@Attila KovacsThe whole point is that I have nothing to do with the program. . There is nothing to debug. as I made a new project from a working file and it does not work. Read carefully what I wrote
-
@DelphiUdIT Read carefully. Mad a new project by copping from backup the dpr pas dfm and compile it does not work. It has nothing to do with dproj But you gave me an IDEA I will check dproj on both programs
-
@Die Holländer In the About it does not say what I have. As far as I recall I have professional In the license, it says professional.
-
I have TDBEdit. I entered a number and would like to know BEFORE POST if the number exists in the database and cancels the post. If OK (number does not exist ) the POST is executed Now it gives a LOCK condition. What I tried procedure TForm1.FDTable1BeforePost(DataSet: TDataSet); begin Form1.FDQuery1.SQL.Clear; Form1.FDQuery1.SQL.add('Select *'); Form1.FDQuery1.SQL.add('from WeighingCows'); Form1.FdQuery1.SQL.add('WHERE Cownumber = :Cownumber'); Form1.FDQuery1.ParamByName('Cownumber').AsString := Drivers.DBEdit1.Text; Form1.FDQuery1.Open; if Form1.FDQuery1.RecordCount > 0 then begin MessageDlg('This number exist', mtError, [mbOK], 0); FDTable1.Cancel;<<<<<<<<<<< if execute then OK end; Form1.FDQuery1.Close; end; I got a LOCK condition. It seems I am not allowed to use SQL and table at the same time. I also tried FDTable1.CachedUpdates is true but then Form1.FDTable1.ApplyUpdates() ; gave LOCK too. Any help? P.S I tried that too //Form1.FDQuery1.Connection:=nil; //Form1.FDTable1.ApplyUpdates() ; //Form1.FDQuery1.Connection:=Form1.FDConnection1;
-
It seems to be OK to running exe NOT in IDE
-
I add procedure TForm1.FDTable1PostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin Action:=daAbort; end; still 1 window messeg
-
@fr0st The first suggestion did not help lock. The unique suggestion seems to work but catching the error seems not to stop the window message; For a moment it enters data into DBGRID until I cancel 1. I do not want the Windows error messages only mine 2. If possible not create the record but that is not important as the cancel will delete it. #1 is the most important. procedure TForm1.FDTable1Error(ASender, AInitiator: TObject; var AException: Exception); begin MessageDlg('err1', mtWarning, [mbOK], 0); FDTable1.Cancel; end; procedure TForm1.FDTable1PostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin MessageDlg('err2', mtWarning, [mbOK], 0); FDTable1.Cancel; end;
-
Thanks, i will try both suggestions
-
I need just advice. I have no problems. I have IdTCPServer IdTCPClient with more than one client. I am using the server as a response to clients. However, I would like to send specific client information from the server, which is impossible. However, I saw a TIMER answer which I liked at the end of https://stackoverflow.com/questions/5530038/how-to-handle-received-data-in-the-tcpclient-delphi-indy Here comes the knowledge. If the server sends a message to whom does he send it? To all clients? Or else? The server message is not a response to the client message. I could not find a write instruction with the peer number. As I have the PeerPort on my server software (I keep a list) I suspect it is not possible to send from server text to a specific Client. A solution is to embed in the message a sign that a specific client will recognize. Any other solution in your opinion?
-
@Remy Lebeau As usual you are the greatest. Thanks But also everybody thanks
-
Just for knowledge. How will you save TIdContext and then interrogate the list? In my case, I use a stringlist with peernumber=worker# it is very helpful to search for peernumber. or vice versa. clients.IndexOfName(IntToStr(PeerPort)); in one case. or vice-versa. P.S. I do not suspect using outside the network of the project.
-
Thank you all. I was thinking of using the above when someone changes data in the server and notifying the client. @Remy Lebeau Thanks very enlightening. For now, the clients are those that initiate the need for data from the server.
-
To clarify the application The client is a worker. He has a number in the server DB. Connection is done when the worker send his ID=DB number and get needed information from server. The exchange is very simple. Obviusly the server gets worker number and associate the peerport to it. I get all kind of messeges for worker where he get data from DB in the server.
-
I think i do not understand. The peerport is assigned AFTER connection. An ID? where is it. Do you know it before connection.Does it equel peerport so it is the same. In my techinc LIST has all necesery information to identify the client. PeerPort changes every time you reconnect to server and is not fixed. Further more in the SERVER I associate user to peerport of the client so I know who is using the client. In the IdTCPServer1Execute I know who is connected as I send info from client to server So what is left to do is pick the right info from my LIST port=user and sent what ever to port.
-
I have a nice solution You can send any string to any client This is just the general idea and someone mite use this On the client put the timer procedure TForm1.Timer1Timer(Sender: TObject); var s: string; begin if not IdTCPClient1.Connected then Exit; if IdTCPClient1.IOHandler.InputBufferIsEmpty then Exit; s := IdTCPClient1.IOHandler.InputBufferAsString; Memo1.Lines.Add('Received: ' + s); end; On the server Use the list procedure TForm2.Button2Click(Sender: TObject); var List: TList; T:TStringList; i:Integer; begin T:=TStringList.Create; t.Add('1234'); List := IdTCPServer1.Contexts.LockList; TIdContext(List.Items[0]).Connection.WriteRFCStrings(t); IdTCPServer1.Contexts.UnlockList; t.Free; end; Keep the client list List.Items[0]<< 1 2 3 4 and so on It needs more work but it works This is a general idea; I added listview with the client list and used it And it works nicely. TIdContext(List.Items[StrToInt( ListView1.Selected.Caption)]).Connection.WriteRFCStrings(t);
-
I have a software solution but I want to understand and have a nicer fix. I have UDPClient and UDPServer I receive a text from the server with a press of a button on the client. If I press once I get the text OK Second time I get Zero in the buffer. I made sure that the server sends the text every time. So I made a stupid fix that works perfectly. UDPClient.ReceiveBuffer(Buf); if buf[0]=0 then UDPClient.ReceiveBuffer(Buf); Any idea why it happens I read a question about resetting the client buffer. Further, if I delete the connection and reconnect it works. But I am not allowed to do so as the connection has to stay with the right peer number.
-
I do not understand why I ever got into this business.? Thanks my bug.
-
OK thanks I have written a client-server for testing and it works perfectly So it might be that something in my huge software does the problem. So back to the drawing board
-
@Remy Lebeau First thanks. Indy's. It is so simple UDPClient.Send('#2'); server response mytext := StringToBytes(s); UDPServer.SendBuffer(ABinding.PeerIP, ABinding.PeerPort, mytext); I am profesional to exclude that. checking with a brp on the server and seeing the problem in the client Most of the time strings are very short. But in that case, the string is a bit longer like maybe 100 characters. And I expect to receive even longer strings. It seems something within the receiver (client) as The server works perfectly. If things are not stable I will move to a different communication
-
@Remy Lebeau First thanks. Indy's. It is so simple UDPClient.Send('#2'); server response mytext := StringToBytes(s); UDPServer.SendBuffer(ABinding.PeerIP, ABinding.PeerPort, mytext); I am profesional to exclude that. checking with a brp on the server and seeing the problem in the client Most of the time strings are very short. But in that case, the string is a bit longer like maybe 100 characters. And I expect to receive even longer strings. It seems something within the receiver (client) as The server works perfectly.
-
With frxReport1 why do I have 2 same-page reports? I made only 1. I cannot find where to change that
-
First thank you, everybody. Second, now it works. Why? This one up there knows. I started everything all over slowly checking every step. Did the same thing (?) again. That is our profession's frustration and then success. P.S. Once in a while return to D7 (old projects) and the report works without any glitches.