如何获取mysql设置的自动增长的主键id值






错误代码:
package test_path;
import org.junit.Test;
import java.sql.*;
public class MoHuAndDeleteTest {
@Test
public void testMoMu(){
Connection conn=null;
PreparedStatement ps=null;
ResultSet rs=null;
try{
//1、注册驱动
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test1", "root", "root");
ps=conn.prepareStatement(

本文介绍了在MySQL中如何正确获取设置为自动增长的主键ID值,包括错误和正确的代码示例。
3781

被折叠的 条评论
为什么被折叠?



