I want to send automatic mail from my Delphi application with attachment without invocation of any client tool like outlook. Actually My application runs as a windows service and every 5 minute generate some response files. I want those files to be mailed automatically. But how do I do that?
Im not in with Delhi but what i do is: create an EML-file, open a socket and send the stuff. Actually it is not so difficult to create a socket that follows the SMTP-protocol...
If you like i can give you some code to do that (or look at the RFC's describing the SMTP-protocol)
I'm controling excel successfully, but now I came up with a problem.
I use Excel97.pas due to compatibility reasons. With this I successfully control 100% of excel 97-2003 and 90% of excel 2007.
It is for complex export of data with Pivots and Charts. The only thing not working in 2007 is the build in charttypes but that is not so important, but help there would also be appreciated.
But now the problem:
I'm starting excel in a new instance. When I try to enable the events, however this fails wenn an other instance has the printpreview open. For now I present a message telling the user to close the preview, but I prefer to do without. I have not found any way to close the preview or any other way around it.
I use an ADOQuery, ADODataSource and DBGrid to populate a Read-only DBGrid from an Access table. I then use an ADOCommand to execute an SQL statement to either Update, Insert or Delete a record in the table. How do I get the DBGrid to automatically display the updated table? I have tried to Refresh or Update the DBGrid, also Close and Open, and Active=False and True on the ADOQuery, all to no avail.
I tried to define a TDataSource which I can Create before running the query and FreeAndNil afterwards but, I get an error 'Not enough parameters' when I do MyDataSource := TDataSource.Create. I think this approach could work?
All I have is an ADOQuery, an ADODataSource and a DBGrid. I tried to create the ADOQuery and DataSource programmatically but it did not work. I have not tried to do the same with the DBGrid. To my knowledge a DataSource does not have an Active, Close, Open or Refresh property, that's why I tried creating and freeing it but the data still did not change in the DBGrid.
Str := 'UPDATE tblTransaction SET tblTransaction.Category = "' + NewCat+ '", ' +
'tblTransaction.TaxDeductable="' + NewExp + '" ' +
'WHERE (((tblTransaction.Category) = "ZZZZ"));';
cmdCategory.CommandText := Str;
//and then this bit in the ShowData procedure
with qryCategory do
Active := False; //I also tried Close and Open
ConnectionString := cnnStr;
SQL.Text := 'SELECT Category,Expense FROM tblCategory ORDER BY Category';
Active := True;
//The DBGrid should now show this change
You should use only one connection.
If you set a connection string on a ADOQuery or ADOCommand then the VCL will generate a new hidden connection in the background for the component.
Each connection has it's own cache inside of the driver (jet engine) for the access database.
If you modify the database through one connection the other connection will not see this change immediatly.
It needs about 6 to 10s to write the changes to the *.mdb file.
After that the other connection has the opportunity to read the changes.
==> allways use only one connection (TADOConnection)
Want to send a jpeg as an attachment without using file folder to save the attachment temporarily.
Is it possible to insert the jpeg file from application inside the message body as OLE? If yes, how to do this?
I'm writing an opc client in delphi and I'm having some problems with the ondatachange event. It is giving me an event failed with error code 0x80010105. It would appear that when i'm busy with handling an event i'm getting the next and then i'll get an error.
My question is does anybody know how I can possibly solve this?