copyTo() method
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   juri_vrljicak
Posted On:   Saturday, October 22, 2005 01:27 PM

Hi there, I have got a question for you.



public static void copyTo(java.lang.String[] sourceNames,
ReadRow sourceRow,
java.lang.String[] destNames,
ReadWriteRow destRow)



I cannot manage to make this method work when trying to copy an object from one Dataset into another Dataset that has a different structure. I get no exception and i think i followed everything as in doc.



Anyone can show a nice piece of code regarding this?



Many thanks.

Re: copyTo() method

Posted By:   juri_vrljicak  
Posted On:   Wednesday, November 9, 2005 11:10 AM

i managed to worked it out like this...


public void jdbTable3_mouseClicked(MouseEvent e) {
//source

ReadRow readRow = (ReadRow) queryDataSetArticles.getStorageDataSet();

//destino
DataRow dataRowLineas = new DataRow(queryDataSetLineas);
ReadWriteRow readWriteRow = (ReadWriteRow) dataRowLineas;

//Cabecera
DataRow dataRowCabecera = new DataRow(queryDataSetCabecera);
ReadRow readRowCabecera = (ReadRow) queryDataSetCabecera.
getStorageDataSet();

String uid = readRowCabecera.getString("uid");
// System.out.println(uid);

// System.out.println(readWriteRow.getColumn(1));

queryDataSetArticles.copyTo(new String[] {"id", "sku", "producto",
"color", "size"},
readRow,
new String[] {"article_id", "sku",
"product", "color", "size"},
readWriteRow);

System.out.println(readWriteRow);

readWriteRow.setString("uid", uid);
readWriteRow.setInt("quantity_ordered", 0);
readWriteRow.setInt("quantity_delivered", 0);
System.out.println(readWriteRow);

DataRow dataRow = (DataRow) readWriteRow;

queryDataSetLineas.addRow(dataRow);

queryDataSetLineas.saveChanges();
queryDataSetLineas.refresh();

}

About | Sitemap | Contact