我正在尝试解决我的错误,但我经常看到这个错误。帮我解决这个问题。
public static void fetchDetails() throws SQLException
{
int i;
Scanner scann = new Scanner(System.in);
Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/AttendClass","ms","6079");
Statement st = c.createStatement();
System.out.println("\n1.Civil\n2.CSE\n3.ECE\n4.EEE\n4.ICE\n5.IT\n6.MECH\n7.MBA\nChoose Your Department: ");
ch = scann.nextInt();
switch(ch)
{
case 1:
dept = "CIVIL";
String tbl1 = "CREATE TABLE "+dept+"(bno int NOT NULL AUTO_INCREMENT,one varchar(30),two varchar(30),three varchar(30),four varchar(30),five varchar(30),six varchar(30),seven varchar(30),eight varchar(30)),PRIMARY KEY (bno)";
st.executeUpdate(tbl1);
ResultSet rs = st.executeQuery("select * from "+dept+"");
System.out.println("Enter the no. of students: ");
i = scann.nextInt();我期望自动递增我的表的输出。
发布于 2019-09-01 03:14:04
下面是如何增加你的主键
下面的代码是用于创建Derby数据库表的字符串语句
String SQL_CreateCBBalance = "create table CBBalance ("
+ "MID int not null generated always as identity "
+ " (start with 100,increment by 1),"
+ "masterbalance varchar(20),"
+ "primary key (MID))";https://stackoverflow.com/questions/57213657
复制相似问题