|
Cyber12 wrote: The Error is: java.lang.NullPointerException Which means that you are tring to refer to an item by an invalid reference. You should try to break the offending statement into its constituent parts and then use your debugger to find out why you have a NULL pointer in there. In the above case something like:
Double dblValue = tblviewTaxDetails.getValueAt(i,5);
sum += dblValue;
Understanding what NullPointerException s are, what can cause them and how to avoid them, will make your life considerably easier.
Veni, vidi, abiit domum
|
|
|
|
|
Thanks!!! Problem Solved!!! It was because of the number of rows in the JTable!!!! It must be equal to the number of values to be summed up!!! My JTable initially had 100 rows, I tried it adjusting the number of rows equal to the number of records displayed in the JTable! It's now working properly! Thanks!
|
|
|
|
|
What will be the default value of indexes when i create
char[] ch = new char[50];
|
|
|
|
|
What indexes are you talking about?
Veni, vidi, abiit domum
|
|
|
|
|
such as index ch[5] ... i just want to know is null="" ???
|
|
|
|
|
What happens when you try it, or use your debugger to check?
Veni, vidi, abiit domum
|
|
|
|
|
|
i have to write junit testcases using annotation for spring application can anyone suggest link or tutorial to me.
|
|
|
|
|
|
that search even me also did.but i didnt get propely how to do with annotations
|
|
|
|
|
|
I have a form in which I have made File no field which hold the Integer value like 1-2-3-4 and so on.
I want that ,when I save a form which has file no 1 ,and then after when I want to save the next record it should remember the last file no and increment by 1.
I have not coded yet anything because I don't know if it is possible?
|
|
|
|
|
chdboy wrote: I don't know if it is possible? It definitely is possible. You just need to use a variable to hold the value, and use that to display in the field. Every time you save a file, increment the value and refresh the displayed field.
Veni, vidi, abiit domum
|
|
|
|
|
thanks for the Idea I'm working on it.
EDIT:
I managed to do what I wanted BUT...
It only happens till the application is open and I'm saving data one after one...as soon as I close to application and opens in again I have see the last file no and enter the next file no manually.
with this code
String filenostr = filenotxtfield.getText();
statement.setString(1,filenostr);
int fileno=Integer.parseInt(filenostr);
fileno++;
String convertno=String.valueOf(fileno);
filenotxtfield.setText(convertno);
statement.executeUpdate();
int rowsAffected = statement.executeUpdate();
if(rowsAffected > 0)
{
JOptionPane.showMessageDialog(null, "Data Inserted successfully!");
}
else
{
JOptionPane.showMessageDialog(null, "Data is not Inserted!", "Not successfully", JOptionPane.ERROR_MESSAGE);
}
statement.close();
con.close();
Addition to that I'm getting error on line
int rowsAffected = statement.executeUpdate();
ERROR:
com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'PK__Employer__6F09E6800F975522'. Cannot insert duplicate key in object 'dbo.Employer'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314)
But as I see in my Management Studio that the data has been saved.but still getting this error ..why?
modified 22-Nov-13 1:08am.
|
|
|
|
|
I'm able to display the value after data is saved, but it is showing me wrong value with this code.
int fileno1=Integer.parseInt(Result.getString(2));
int increment = ++fileno1;
String convertno1=String.valueOf(increment);
filenotxtfield.setText(convertno1);
If 1 and 2 file no already exists after entering 3rd number manually and then save it ,it is showing me 2 not 4.?
|
|
|
|
|
That code looks fine as it stands, but you are not saving the updated count anywhere.
Veni, vidi, abiit domum
|
|
|
|
|
Do I have to save it in the database and then retrieve it?
int increment = ++fileno1;
I have to save increment in the database?
|
|
|
|
|
It depends on how long you need the value, but you have to save it somewhere. If you only need the value for a single execution of the program, then just keep it in memory. If you want to continue where you left off with another separate execution, then you need to kepp it somewhere permanent, database, property etc.
Veni, vidi, abiit domum
|
|
|
|
|
ok right now I have not made is permanent,but I think I will save it in the database so when the application loads it will still remember the last file no ...thanks for the Idea.
Right now I have done it with this code.
int fileno1=Integer.parseInt(Result.getString(2));
int increment = ++fileno1;
int increment2 = ++increment;
filenotxtfield.setText(Integer.toString(increment2));
I have used this code after inserting the data in the database.So now as you suggested I'm working on how to show the next file no upon application starts.
|
|
|
|
|
I'm not sure if you're aware of this. But what this code does is essentially:
int fileno1=Integer.parseInt(Result.getString(2));
fileno1 = fileno1 + 1;
int increment = fileno1;
increment = increment + 1;
int increment2 = increment;
filenotxtfield.setText(Integer.toString(increment2));
if you just want to increment the value of fileno1 (and don't need those variables increment and increment2) by 2:
int fileno1=Integer.parseInt(Result.getString(2));
fileno1 = fileno1 + 2;
filenotxtfield.setText(Integer.toString(fileno1));
|
|
|
|
|
Yes that didn't come to my mind...thank you
|
|
|
|
|
gan gmna ya caranya bikin converter video klo lwat java?
|
|
|
|
|
This is an english website - Please aks your questions in english, or head over to a website serving your language needs.
Veni, vidi, caecus
|
|
|
|
|
Bahasamu sedikit mirip dengan bahasa Indonesia. Dan halaman profile-mu juga berkata bahwa negaramu Indonesia. Lihatlah: sinilah kami bercakap pada dalam Inggris. Belajarlah bahasa Inggris!
Dan mengapa tidak tahu menulis bahasa Indonesia dengan baik? Saya sudah membaca buku-buku dengan ribuan halaman pada dalam bahasa itu, tetapi tidak dapat megerti tanyaanmu.
|
|
|
|
|
Hey,
This will be difficult to explain. I'm not sure if you'll understand. Don't know how to describe it in a good way.
We are 2 developers.
I wrote 2 different WCF's in C# and there are several that will follow. They all share 7 common functions that a user is able to call.
My mate wrote a programm that takes those WCF's.
You can "login" to his program and Choose one of my WCF's via name. And then his program will forward all messages from the chosen WCF to you.
We tried the following:
Create a WebService in Java with those 7 functions and download the WSDL.
Then change the endpoint-URL inside the generated files to the WCF-URL that the user has chosen.
The problem is microsoft.
Microsofts WCF has a unusual WSDL-File.
The same for the .asmx-Webservices.
They are different from the Java - WSDL (Therefore the generated sources are different, too) though the provided functions are the same.
From Java you can consume both asmx and WCF - Services,
but not in a generic way, because when we do it as we do, we get the message that the WSDL at this endpoint is different from the WSDL that we have.
I hope the text was not toooooo confusing.
Does anyone know a solution ?
Greetings,
SheraX
Bildlich:
http://www.upload-pictures.de/bild.php/43100,webserviceSW5Q8.png[^]
|
|
|
|