ResultSet rs=st.executeQuery("select * from category");
rs.moveToInsertRow();
rs.updateString("cname",c);
rs.insertRow();
rs.moveToCurrentRow();

i want to insert new row in table of sqlserver2000 database the row should insert at last in a table .can i use variable at place of value in updateString("column name","value") the code i m using is here

Member Avatar for LastMitch

can i use variable at place of value in updateString("column name","value") the code i m using is here

If you have everything setup correctly then YES you can used this:

rs.moveToInsertRow();
updateString("column name","value") 

But if you don't have it set up correctly

You need something like this:

//CREATE/SELECT query
public static void create()
{CREATE/SELECT query and other code etc..}
//INSERT query
public static void insert()
{INSERT query and other code etc..}
//UPDATE query
public static void update()
{UPDATE query and other code etc..}
//DELETE query
public static void delete()
{DELETE query and other code etc..}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.