Problem to the exception

Hi,
I do not know why I get this exception

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
      The operator + is undefined for the argument type(s) String, void

due to the codes below

			if(cWaybillID == "")
			{

				sql = "insert into tab1 set " +
						" in_time = current_timestamp, " +
						" mod_time = current_timestamp, " +
						" in_by = " + GetSqlString(cUser) + ", " +
						" mod_by = " + GetSqlString(cUser) + ", " +
						" status = 'store_rcv', " +
						//" store = " + GetSqlString(cConvStoreCode) + ", " +
						" waybill_num = " + GetSqlString(cWaybill) + ", " +
						" price = " + GetSqlString(cFeeAmt) + "," +
						" remote_charge = " + GetSqlString(TransferFee) + "," +
						" total_price = (" + GetSqlString(TransferFee) + " + " + ((GetSqlString(cFeeAmt)=="") ? "0" : GetSqlString(cFeeAmt)) + ")," +
						" phone = " + cMobile + "," +
						//" sms_time = " + cStockOutTime + ", " +
						//" bar_time = " + GetSqlString(cBarTime) + ", " +
						" store_dscr = " + GetSqlString(cConvStoreDscr) + ", " +
						//" store_rcv_time = " + GetSqlString(cBarTime) + ", " +
						//" stockout_time = " + cStockOutTime + ", " +
						//" stockout_time = " + GetSqlString(cBarTime) + " ";
						" stockout_time = current_timestamp ";
				Execute_SQL(sql);

			} else {
				sql = "update tab1 set " +
						" mod_time = current_timestamp, " +
						" mod_by = " + GetSqlString(cUser) + ", " +
						" price = " + GetSqlString(cFeeAmt) + "," +
						//" total_price = (remote_charge + " + GetSqlString(cFeeAmt) + ")," +
						" total_price = (remote_charge + " + ((GetSqlString(cFeeAmt)=="") ? "0" : GetSqlString(cFeeAmt)) + ")," +
						" phone = " + cMobile + " " +
						" where waybill_num = " + GetSqlString(cWaybill) +
						" and id=" + GetSqlString(cWaybillID);
				Execute_SQL(sql);
			}

while both remote_charge and total_price are declared as decimal columns on Mysql database.

Open in new window

LVL 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
It is very hard to tell where the issue is, other than how is the method GetSqlString defined? Double check that it returns a String.

Other issues that I can see in the above, is that there are a couple of checks where you are trying to compare a String using ==    You can't do that. You have to use the .equals() method. ie. instead of the first line in the above snippet, use the following...

if (cWaybillID.equals(""))

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HuaMin ChenProblem resolverAuthor Commented:
Many thanks. Yes, the method should be returning string.

How to further transfer string into decimal to the above codes?
HuaMin ChenProblem resolverAuthor Commented:
And it seems the problem is owing to "+", right?
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

HuaMin ChenProblem resolverAuthor Commented:
Any help?
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Yes, the method should be returning string.
It "should be" or it definitely IS defined to return a String object?

Can you post a screenshot showing Eclipse's error message and the red underlining? It may help narrow the problem.


How to further transfer string into decimal to the above codes?

Can you explain further? Do you mean that you want to convert a String object some number type, such as int, float, double, etc? If so what number type do you need it in?


And it seems the problem is owing to "+", right?

Going by the error message that you posted, yes. But if you post the screenshot that I just mentioned above, we can confirm that.
HuaMin ChenProblem resolverAuthor Commented:
The error is showing the exception message I posted in above.

I want to convert it to decimal. How?
mccarlIT Business Systems Analyst / Software DeveloperCommented:
I asked for a screenshot because Eclipse can actually highlight more specific problems than just what you wrote above "due to the codes below"

I want to convert it to decimal. How?
If you continue to just repeat your request without clarifying the information that I ask for, I won't be able to assist you any further.
HuaMin ChenProblem resolverAuthor Commented:
Here is the exception I can see
16should I convert

GetSqlString(cFeeAmt)

to decimal?
HuaMin ChenProblem resolverAuthor Commented:
Very sorry, please omit the previous reply. Such exception below

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
	The operator + is undefined for the argument type(s) String, void

	at WQS_sfhkshop.updateConvStoreVG(WQS_sfhkshop.java:1207)

Open in new window

is actually due to line 1207, that is
      
			System.out.println(TIME_FORMAT.format(new Date()) + " Start Update Conv Store VanGOlll"+ex.printStackTrace());

Open in new window


how to correct the line in above?
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Ok, that is making a bit more sense. As the error message is telling you "ex.printStackTrace()" doesn't return a string. It does the printing to the console for you. So the easiest way to do what you are trying to do above is this...

System.out.print(TIME_FORMAT.format(new Date()) + " Start Update Conv Store VanGOlll");
ex.printStackTrace(System.out);

Open in new window

mccarlIT Business Systems Analyst / Software DeveloperCommented:
Why the 'B' grades for the last couple of questions that you have closed?

See here....   http://support.experts-exchange.com/customer/portal/articles/481419
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.