• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with MySQL syntax

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends,

I would like to retrieve email address from database, but I am not be able to get the value and store into my Sender. When I hardcode my email, it can send out the mail successfully, but when I use SQL to retrieve, it cannot run. Pls help...


\\Define Variable
<%String Tabcont="", dte="",Subject="", ln_num ="",remark="",pur="",in_desc_combine
="",mtr_cde
="",selectExceed1="",seqDftran="",Body="";
String Rej="";
double qty=0;
String emailadd="", Sender="",Recipient="";%>

\\SQL query
String emailaddSender=" SELECT em_email_addr FROM emmast "+
" WHERE em_name = '"+ whoReject+"' ";
ResultSet emSender = null;
try {emSender = db.execSQL(emailaddSender);}
catch (SQLException e)
{System.err.println("Error-123");}
if(emSender.next()){
Sender=emSender.getString("em_email_addr");}

\\pass in parameter
checkstatus();
{
<%if (rec_status.equals("R"))%>
<%{%>
<%send.sending(SMTPServer,Sender,Recipient,CcRecipient,BccRecipient,Subject,Body,Attachments);%>
<%}%>
}

**I am not sure what is the mistake I did in my sql query, please help

Thank You
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would you like to paste the code in a good format?thank you
[ February 26, 2006: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Its a bad idea to put your logic in a JSP like this - it makes your code difficult to read and maintain.

Rather put it into a utility class - at the moment you are opening up yourself to all sort of problems that can occur due to a misplaced key stroke.

Im not answering your questio here but while you are doing this you might find the problem anyway.

Chris
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you post the exception you get?
 
reply
    Bookmark Topic Watch Topic
  • New Topic