Results 1 to 7 of 7
Thread: Object message
- 06-11-2012, 12:41 AM #1
Member
- Join Date
- May 2012
- Location
- Algeria-Tiaret
- Posts
- 12
- Rep Power
- 0
Object message
Hello
I am working with Netbeans and the JADE platform for the creation of agents and I have a database also
So I want to know how I can send an object that contains ID "Integer" and this object is the result of a query that results in 0.1 or several ID
That's a part from my code:
Java Code:Object[] obj={"Id1 1","Id 2","Id 3","Id 4","Id 5","Id 6"} ; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cnx = DriverManager.getConnection("jdbc:odbc:Produits_link"); St = cnx.createStatement(); ResultSet Rs; i=0; Rs=St.executeQuery("Select * From Liste_produits WHERE (Nom_produit=msg"); while (Rs.next()){ i=i+1; Id = Rs.getInt("Id"); // obj=Id; try { // Le contenu de réponse est l'objet <obj> reply.setContentObject(obj); } catch (IOException e) { e.printStackTrace(); }Last edited by DarrylBurke; 06-11-2012 at 08:19 AM. Reason: Removed CENTER formatting
- 06-11-2012, 08:24 AM #2
Re: Object message
I've removed the annoying CENTER formatting that you placed around your entire post, as it makes the text extremely difficult to follow. This is at least the third time I've done this for you. In future, if you post with crazy formatting, I'm going to ignore it, and almost all members here won't even try to read it.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 06-11-2012, 10:59 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Object message
So you're getting a list of ids from the database.
So make a List<Integer> and use that?
Not knowing what your actual requirements are I doubt anyone could say more than that.Please do not ask for code as refusal often offends.
- 06-11-2012, 11:08 PM #4
Member
- Join Date
- May 2012
- Location
- Algeria-Tiaret
- Posts
- 12
- Rep Power
- 0
Re: Object message
my database table contains a list of products, each product has an ID "Integer".
I would sent a message that contains a list of ID and I did not know the nembre of these elements
- 06-12-2012, 09:30 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Object message
So use a List<Integer> instead of Integer[].
Please do not ask for code as refusal often offends.
- 06-12-2012, 10:10 AM #6
Member
- Join Date
- May 2012
- Location
- Algeria-Tiaret
- Posts
- 12
- Rep Power
- 0
- 06-12-2012, 10:29 AM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Object message
Collections tutorial.
That will give you a good overview of how the collections framework works.
And I would question why a beginner who does not know about that framework is doing JDBC.Please do not ask for code as refusal often offends.
Similar Threads
-
Any chance of getting original type of object from Map<String, Object>?
By Tim99 in forum New To JavaReplies: 1Last Post: 01-09-2012, 04:46 PM -
Insert class file as object in a table & read the object from the blob.
By facemeguru in forum New To JavaReplies: 1Last Post: 02-02-2011, 06:11 PM -
Create object of unknown class, based on existing object
By Zack in forum New To JavaReplies: 2Last Post: 06-22-2010, 04:29 AM -
java message box, how to not show multiple message box with same title or content
By oohay in forum AWT / SwingReplies: 6Last Post: 06-04-2010, 08:43 PM -
how to pass an arraylist from an object back to the parent object that it was created
By george_a in forum New To JavaReplies: 1Last Post: 03-04-2009, 06:14 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks