0

Iam using Jpanel in which when I enter a textfield values say c1 and c2 . These values are stored in row[0] and row[1] and should be passed as a column name and value in my sql syntax.

I'am writing something like this:

 String queryco = "Insert into table(?) values (?)";
 pst = conn.prepareStatement(queryco);

    String c1 = (String)table.getValueAt(row, 0);
    String c2 = (String)table.getValueAt(row, 1);

        pst.setString(1, c1);
        pst.setString(2, c2);

        pst.addBatch();

I'am just a beginner and not sure if this will work. how else can i write the INSERT syntax?

Sneha P
  • 31
  • 1
  • 5

0 Answers0