Thanks all. Just how to I include the selector logic in a search parameter? The variable is designated in the program earlier --hence the use of "doSEARCH" to contain the search parameter previously identified. I use the CRM case numbers as serach parameters. The search CRM number (contained in doSEARCH) is compared to the table record's CRM number.
I am trying to update my derby database but it seems that the update isn't working. Mainly the database doesn't update. I have tried various ways but each seems to not update the fields. Below is my code. I have also tried using the "?" with each column entry (example: PROJNAME = ?) along with PreparedStatements setting the PreparedStatement to a JTextField -but that didn't work either. Using the insert statement works fine --just the UPDATE statement doesn't. The System print (System.out.println) does print all the entries correctly. Any help is appreciated. This is my first time using the UPDATE statement --so I am unsure what I'm doing wrong. I'm using Netbeans 8.2 and Derby.
System Print output:
100 2nd Ave
TBD at CONTRACTING
Thank you for your input. I don't do programming for a living --so my experience and knowledge is limited. However, you have pointed me in a good direction for improving my understanding of Java.
Tim: Clever. I would have never thought of combining the while-next with the counter in the way you did. It actually solved the issue. However, I think I need to learn more, particularly as Cary pointed out to me. So I'm off searching how to do Data arrays for getting output from sql database. So, thank you for your correction.
The method below gets the ALL the fields but then assigns one field output to all my variables. The variables are labeled as TXTXXX (XXX represents a number). The TXT variables are String, Doube, and Interger designated based on the database field format. When I initiate the method, the database is accessed but the last entry is used for all the TXT variables. The Search paramenter works for the first output (TXT392) but not for the other TXT variables. Instead it just substitutes the other TXT variables with the first output. Any advice that helps resolve this problem would be much appreciated.
The below is what I was expecting:
THIS IS TXT392 IN TOTALS SECTION 239463.0
THIS IS TXT332 IN TOTALS SECTION 218810
THIS IS TXT342 IN TOTALS SECTION 3788.4
THIS IS TXT357 IN TOTALS SECTION 150.9791346
THIS IS TXT367 IN TOTALS SECTION 11298.125
THIS IS TXT362 IN TOTALS SECTION 234048
THIS IS TXT377 IN TOTALS SECTION 5601.42
THIS IS TXT382 IN TOTALS SECTION 22150.33
However, I'm getting:
THIS IS TXT392 IN TOTALS SECTION 239463.0
THIS IS TXT332 IN TOTALS SECTION 239463.0
THIS IS TXT342 IN TOTALS SECTION 239463.0
THIS IS TXT357 IN TOTALS SECTION 239463.0
THIS IS TXT367 IN TOTALS SECTION 239463.0
THIS IS TXT362 IN TOTALS SECTION 239463.0
THIS IS TXT377 IN TOTALS SECTION 239463.0
THIS IS TXT382 IN TOTALS SECTION 239463.0
Thank you so much for your persistence and support on this. I added the two lines you sent me and the reason the program didn't send the other 2 attachments was that I had the wrong file ending. It should have been "csv" and not "xlsx". Honestly, I was embarrassed since I then remember that the two spreadsheet files were actually exported database field entries --so the extension should have been "csv". The program now sends all three files without any issues. Thank you.
Is there some checkmark or uptick for this to show my approval of your support?
With the messageBodyPart3 and messageBodyPart4 included in the code I get an error message that states it can't find the next file (Plumb1-13052021.xlsx). However, all three files are in the same directory and it has no problem finding the first attachment (Plumb-13052021.docx). So it runs okay with the 3rd and 4th attachments "commented out." The error states it can't find the next attachment (Plumb1-13052021.xlsx) even though it has no problem locating the first one.
I'm using Java.mail-1.6.0 and activation-1.1. Here's error I'm getting:
Ron -- I see what you are referring to -the msg.setContent is within the loop so it gets replaced each time. That seems to be the problem even with the version you posted. Here's why: I can comment out the 2nd and 3rd files and the program will send the 1st file easily in both Paul's and yours. In both versions (Paul & Ron) the program can't find the following files even though all three files are in the same directory. However, I did set print so I can see that the array is working fine and the files are being accessed sequentially. However, only the last file itinerary is actually used. Since I have 4 loops, the last file added is the first one.
I tried moving the setContent outside the "for loop" but then I get an error stating that multipart can't be found. I do agree with your assessment as to the setContent getting files replaced each time the loop calls a new file. Just don't know how to resolve that. The problem is consistent with each version sample I use. All other portions work fine --multipart just will not keep all three files -- merely replaces each file as the new one is called.
Thank you so much for your willingness to help me with this. I redid the multipart section to reduce some of the clutter and am still getting just one attachment being sent. I read your tutorial and it helped me reduce all the excess code lines. However, I still can't seem to attach the 2nd and 3rd file attachments. It attaches the first file with no problem and sends the email to the recipient. Below are the multipart changes I made. I use System print to verify that the file selection and the attachment part were not empty. Both seem to be working okay. I'm just missing something in my code to tell the multipart that it needs to recognize each file independently and keep them as attachments.
The below code sends 1 attachment to a recipient. However, I need to send 3 files to the recipient. This is my first attempt at using JavaMail and the am finding difficulty resolving the "multipart" section to accept 3 files. The issue is that while each file is selected and each multipart is there, the last portion of the multipart (multipart3 and multipart4) is not added to the message. If I comment out the last two (multipart3 and multipart4) lines of the msg.setContent, then the message goes through with the first attachment. Really could use some help in this.