会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132453个问题

请问老师 这是什么情况 应该如何解决啊

package com.wxc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Test01Jdbc {
    //向Departments表中添加一条数据
    public void insertDepartments(String department_id,int location_id){
        Connection conn=null;
        Statement state=null;
        try {
            //驱动注册   实例化数据库驱动对象
            Class.forName("com.mysql.jdbc.Driver");
            //创建连接
            conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/bjsxt?useUnicode=true&characterEncoding=utf-8&useSSL=false","root","Bugaosun1");
            //创建执行SQL的语句statement
            String sql="insert into departments values(default,'"+department_id+"','"+location_id+"')";
            state=conn.createStatement();
            int flag=state.executeUpdate(sql);
            System.out.println(flag);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            if (state!=null){
                try {
                    state.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            if (conn!=null){
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    public static void main(String[] args){
        Test01Jdbc test=new Test01Jdbc();
        test.insertDepartments("研发部",8);
    }
}

image.png

JAVA 全系列/第三阶段:数据库编程/JDBC技术(旧) 16501楼
Python 全系列/第四阶段:函数式编程和核心特性/函数式编程核心(高阶函数、闭包等) 16502楼

image.png

Python 全系列/第十一阶段:重量级Web框架-Django/Redis的入门与应用(拓展) 16503楼
JAVA 全系列/第一阶段:JAVA 快速入门/面向对象详解和JVM底层内存分析 16504楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/数据结构 16505楼
JAVA 全系列/第一阶段:JAVA 快速入门/飞机大战小项目训练 16510楼

from tkinter import *
from tkinter import messagebox
import random

class Application(Frame):
    def __init__(self, master=None):
        super().__init__(master)  # super()代表的是父类的定义,而不是父类对象
        self.master = master
        self.pack()
        self.createWidget()


    def createWidget(self):
        """通过grid布局管理实现计算器的界面"""
        btnText=(('MC','M+','M-','MR'),
                 ('C','±','÷','×'),
                 (7,8,9,'-'),
                 (4,5,6,'+'),
                 (1,2,3,'='),
                 (0,'.'))
        Entry(self).grid(row=0,column=0,columnspan=4,pady=10)
        for rindex,r in enumerate(btnText):
            for cindex,c in enumerate(r):
                if c == '=':
                    Button(self,text=c,width=2).grid(row=rindex+1,column=cindex,rowspan=2,sticky=NSEW)
                elif c == 0:
                    Button(self, text=c, width=2).grid(row=rindex+1 , column=cindex, columnspan=2, sticky=NSEW)
                elif c == '.':
                    Button(self, text=c, width=2).grid(row=rindex + 1, column=cindex+1, rowspan=2, sticky=NSEW)
                else:
                    Button(self, text=c, width=2).grid(row=rindex + 1, column=cindex, sticky=NSEW)





if __name__ == '__main__':
    root = Tk()
    root.geometry("400x300+200+300")
    root.title("一个经典的GUI程序类测试")
    app = Application(master=root)
    root.mainloop()

老师,为什么我的等于号没有跨行的

21.jpg

Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 16512楼
Python 全系列/第一阶段:Python入门/控制语句 16514楼
JAVA 全系列/(旧的隐藏)第七阶段:JAVA 高级技术/Nginx 16515楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637