
没有安装或未能初始化关联。源代码管理没有初始化数据库是因源代码管理没有初始化数据库。数据库(DataBase,DB)是按照数据结构来组织、存储和管理数据的仓库。随着信息技术和市场的发展。
odbc是连接数据库的一种方式,sqlserver数据库,代码怎么写要看你用什么样的语言,如果使用sqlserver数据库可以用,可以使用VB。VC。ASP。java。等等,都可以,先设计数据库再设计逻辑,然后用代码实现就可以了。
1、数据(data)是载荷或记录信息的按一定规则排列组合的物理符号。
可以是数字、文字、图像,也可以是计算机代码。
2、数据库(Database)是按照 数据结构来组织、 存储和管理数据的仓库。
3、数据库管理系统是一种 *** 纵和管理数据库的大型软件,用于建立、使用和维护数据库,简称DBMS。
它对数据库进行统一的管理和控制,以保证数据库的安全性和完整性。
4、数据库系统是数据库的使用既可以在程序中实现,也可以在独立的数据 *** 作界面中实现,比如在SQL Server数据库系统中,我们既可以使用T-SQL语言 *** 作数据库,也可以使用SQL Server企业管理器实现对数据库的 *** 作和管理。
import javaawtBorderLayout;
import javaawtCardLayout;
import javaawtContainer;
import javaawtFont;
import javaawteventActionEvent;
import javaawteventActionListener;
import javaxswingIcon;
import javaxswingImageIcon;
import javaxswingJButton;
import javaxswingJFrame;
import javaxswingJLabel;
import javaxswingJMenu;
import javaxswingJMenuBar;
import javaxswingJMenuItem;
import javaxswingJPanel;
import javaxswingJToolBar;
import javaxswingSwingConstants;
public class MainFrame extends JFrame implements ActionListener{
InsertPanel ip = null;
SelectPanel sp = null;
JPanel pframe;
JButton jb1,jb2,jb3;
JMenuItem jm11,jm21,jm22,jm23,jm31,jm32,jm41,jm42;
CardLayout clayout;
public MainFrame(String s){
super(s);
JMenuBar mb = new JMenuBar();
thissetJMenuBar(mb);
JMenu m1 = new JMenu("系统");
JMenu m2 = new JMenu("基本信息");
JMenu m3 = new JMenu("成绩");
JMenu m4 = new JMenu("奖惩");
mbadd(m1);
mbadd(m2);
mbadd(m3);
mbadd(m4);
jm11 = new JMenuItem("退出系统");
jm21 = new JMenuItem("输入");
jm22 = new JMenuItem("查询");
jm23 = new JMenuItem("更改");
jm31 = new JMenuItem("输入成绩");
jm32 = new JMenuItem("查询成绩");
jm41 = new JMenuItem("奖励");
jm42 = new JMenuItem("处分");
m1add(jm11);
m2add(jm21);
m2add(jm22);
m2add(jm23);
m3add(jm31);
m3add(jm32);
m4add(jm41);
m4add(jm42);
Icon i1 = new ImageIcon();
Icon i2 = new ImageIcon();
Icon i3 = new ImageIcon();
jb1 = new JButton(i1);
jb1setToolTipText("输入");
jb2 = new JButton(i2);
jb2setToolTipText("查询");
jb3 = new JButton(i3);
jb3setToolTipText("退出");
JToolBar tb = new JToolBar("系统工具");
tbadd(jb1);
tbadd(jb2);
tbadd(jb3);
add(tb,BorderLayoutNORTH);
jm11addActionListener(this);
jm21addActionListener(this);
jm22addActionListener(this);
jb1addActionListener(this);
jb2addActionListener(this);
jb3addActionListener(this);
clayout = new CardLayout();
pframe = new JPanel(clayout);
add(pframe);
JPanel mainp = new JPanel(new BorderLayout());
JLabel mainl = new JLabel("学生信息管理平台",SwingConstantsCENTER);
mainlsetFont(new Font("serif",FontBOLD,30));
mainpadd(mainl);
pframeadd(mainp,"main");
clayoutshow(pframe, "main");
}
public void actionPerformed(ActionEvent e){
if(egetSource() == jm21 || egetSource() == jb1){
if(ip == null){
ip= new InsertPanel();
pframeadd(ip,"insert");
}
clayoutshow(pframe, "insert");
thissetTitle("输入学生信息");
}
else if(egetSource() == jm22 || egetSource() == jb2){
if(sp == null){
sp= new SelectPanel();
pframeadd(sp,"select");
}
clayoutshow(pframe, "select");
thissetTitle("查询学生信息");
}
else if(egetSource() == jm11 || egetSource() == jb3){
Systemexit(0);
}
}
}
第二个:
import javaxswingJFrame;
public class MainTest {
public static void main(String [] args){
MainFrame f = new MainFrame("学生信息管理平台");
fsetSize(400,300);
fsetLocation(350,250);
fsetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);
fsetVisible(true);
}
}
第二个:
import javasqlConnection;
import javasqlDriverManager;
public class MySQLConnection {
static Connection getCon(){
Connection con = null;
try{
ClassforName("commysqljdbcDriver");
con = DriverManagergetConnection("jdbc:mysql://localhost/test","root","123");
}
catch(Exception e){
Systemoutprintln("建立数据库连接遇到异常!");
}
return con;
}
}
第四个:
import javaawtBorderLayout;
import javaawtGridLayout;
import javaawteventActionEvent;
import javaawteventActionListener;
import javaxswingJButton;
import javaxswingJLabel;
import javaxswingJOptionPane;
import javaxswingJPanel;
import javaxswingJTextField;
import javaxswingSwingConstants;
public class SelectPanel extends JPanel implements ActionListener{
JButton jb;
JTextField jt;
JTextField jt1,jt2,jt3,jt4;
public SelectPanel(){
JLabel jl = new JLabel("请输入学号:",SwingConstantsCENTER);
jt = new JTextField();
jb = new JButton("确定");
JPanel jp1 = new JPanel(new GridLayout(1,3));
jp1add(jl);
jp1add(jt);
jp1add(jb);
JLabel j1,j2,j3,j4;
j1 = new JLabel("学号:",SwingConstantsCENTER);
j2 = new JLabel("姓名:",SwingConstantsCENTER);
j3 = new JLabel("性别:",SwingConstantsCENTER);
j4 = new JLabel("年龄:",SwingConstantsCENTER);
jt1 = new JTextField(6);
jt1setEditable(false);
jt2 = new JTextField(6);
jt2setEditable(false);
jt3 = new JTextField(6);
jt3setEditable(false);
jt4 = new JTextField(6);
jt4setEditable(false);
JPanel jp2 = new JPanel(new BorderLayout());
JPanel jp3 = new JPanel(new GridLayout(4,2));
jp2add(new JLabel(""),BorderLayoutNORTH);
jp3add(j1);
jp3add(jt1);
jp3add(j2);
jp3add(jt2);
jp3add(j3);
jp3add(jt3);
jp3add(j4);
jp3add(jt4);
jp2add(jp3);
thissetLayout(new BorderLayout());
add(jp1,BorderLayoutNORTH);
add(jp2);
jbaddActionListener(this);
}
public void actionPerformed(ActionEvent e){
if(egetSource() == jb){
String stuNo = jtgetText()trim();
Student s = new Student();
boolean b = true;
try{
b = sselectByStuNo(stuNo);
}
catch(Exception ex){
Systemoutprintln("查询学生信息遇到异常!");
}
if(b){
jt1setText(sgetStuNo());
jt2setText(sgetName());
jt3setText(sgetGender());
int a = sgetAge();
Integer i = new Integer(a);
jt4setText(itoString());
}
else{
JOptionPaneshowMessageDialog(null, "无此学生!");
}
}
}
}
第五个:
import javaxswingJFrame;
public class SelectTest {
public static void main(String [] args){
JFrame f = new JFrame("查询学生信息");
SelectPanel p = new SelectPanel();
fadd(p);
fsetSize(400,300);
fsetLocation(300,250);
fsetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);
fsetVisible(true);
}
}
第六个:
import javasqlConnection;
import javasqlResultSet;
import javasqlStatement;
public class Student {
String stuNo;
String name;
String gender;
int age;
public Student(){}
public Student(String stuNo,String name,String gender, int age){
thisstuNo = stuNo;
thisname = name;
thisgender = gender;
thisage = age;
}
public String getStuNo(){
return stuNo;
}
public void setStuNo(String stuNo){
thisstuNo = stuNo;
}
public String getName(){
return name;
}
public void setName(String name){
thisname = name;
}
public String getGender(){
return gender;
}
public void setGender(String gender){
thisgender = gender;
}
public int getAge(){
return age;
}
public void setAge(int age){
thisage = age;
}
public boolean insertStudent(){
boolean b = true;
try{
Connection con = MySQLConnectiongetCon();
Statement statement = concreateStatement();
String sql = "insert into student values('" + stuNo + "','" + name +"','" + gender + "'," + age + ")";
sql = new String(sqlgetBytes("gb2312"),"ISO8859_1");
statementexecuteUpdate(sql);
conclose();
}
catch(Exception e){
b = false;
Systemoutprintln("插入数据库遇到异常!");
}
return b;
}
public boolean selectByStuNo(String stuNo)throws Exception{
boolean b = true;
Connection con = MySQLConnectiongetCon();
Statement statement = concreateStatement();
String sql = "select from student where stuNo =" + stuNo;
ResultSet rs = statementexecuteQuery(sql);
if(rs != null && rsnext()){
String no = rsgetString(1);
thissetStuNo(no);
String n = rsgetString(2);
n = new String(ngetBytes("ISO8859_1"),"gb2312");
thissetName(n);
String g = rsgetString(3);
g = new String (ggetBytes("ISO8859_1"),"gb2312");
thissetGender(g);
thissetAge(rsgetInt(4));
b = true;
}
rsclose();
statementclose();
conclose();
return b;
}
}
数据库你自己弄吧,我没时间弄了!初学得多动手哦
以上就是关于源代码管理没有初始化数据库全部的内容,包括:源代码管理没有初始化数据库、如何用sql server创建医院数据库管理系统,代码如何写、简述数据,数据库,数据库管理系统,数据库系统的概念等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)