INSERT Statements
To insert into a table, use the standard INSERT SQL syntax.
INSERT INTO Lead (FullName) VALUES ('John Smith')
String cmd = "INSERT INTO Lead (FullName) VALUES (?)";
PreparedStatement pstmt = conn.prepareStatement(cmd);
pstmt.setString(1, "John Smith");
int count=pstmt.getUpdateCount();
pstmt.execute();
if (count!=-1)
{
System.out.println(count+" rows are affected");
}
To insert into a table, use the standard INSERT SQL syntax.
INSERT INTO Lead (FullName) VALUES ('John Smith')
String cmd = "INSERT INTO Lead (FullName) VALUES (?)";
PreparedStatement pstmt = conn.prepareStatement(cmd);
pstmt.setString(1, "John Smith");
int count=pstmt.getUpdateCount();
pstmt.execute();
if (count!=-1)
{
System.out.println(count+" rows are affected");
}