program to create new Table in MySQL DB : @P-2# package - TopicsExpress



          

program to create new Table in MySQL DB : @P-2# package org.java.*; import java.sql.*; public class ConnectDBtable { public void createFormData(String name,String num){ Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/formdata", "root", null); try{ int no=1,no1 = 0; do{Statement st=con.createStatement(); no1=no; int x; x= st.executeUpdate("create table form"+no+" (Product varchar(20),Fields varchar(20))"); if(x==0){ st.executeUpdate("insert into form"+no+" values (+name+,+num+)"); } else { no++;} }while(no1
Posted on: Sat, 06 Jul 2013 06:38:55 +0000

Trending Topics



Recently Viewed Topics




© 2015