日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

java订单实现的_java订单系统的开发

發(fā)布時間:2023/11/27 生活经验 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java订单实现的_java订单系统的开发 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

問題Exceptioninthread"main"java.lang.NoSuchMethodError:mainPressandkeytocontinue..代碼是importjava.sql.*;publicclassSqlCon{privateConnectionconn=null;publicConnectiongetc...

問題

Exception in thread "main" java.lang.NoSuchMethodError:main Press and key to continue..

代碼是

import java.sql.*;

public class SqlCon {

private Connection conn=null;

public Connection getconnection(){

String sql1="com.microsoft.jdbc.sqlserver.SQLServerDriver";

String sql2="jdbc:microsoft:sqlserver://localhost:1433;databasename=Admin";

try {

Class.forName(sql1);

conn=DriverManager.getConnection(sql2, "sa", "123");

} catch (Exception e)

{

System.out.println("OK");

e.printStackTrace();

}

return conn;

}

}

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.util.*;

import javax.swing.*;

import java.sql.*;

public class Loginframe extends JFrame implements ActionListener{

JLabel lable1=new JLabel("管理員賬號:");

JLabel lable2=new JLabel("管理員密碼:");

JTextField text1=new JTextField(15);

JTextField text2=new JTextField(15);

JButton bt1=new JButton("登陸");

JButton bt2=new JButton("取消");

public Loginframe() {

this.setTitle("管理員登陸窗體");

this.setBounds(200, 200, 260, 140);

this.setLayout(new GridLayout(3,1));

JPanel jp1=new JPanel();

JPanel jp2=new JPanel();

JPanel jp3=new JPanel();

bt1.addActionListener(this);

bt2.addActionListener(this);

jp1.add(lable1);

jp1.add(text1);

jp2.add(lable2);

jp2.add(text2);

jp3.add(bt1);

jp3.add(bt2);

this.add(jp1);

this.add(jp2);

this.add(jp3);

this.setResizable(false);

this.setVisible(true);

}

public void actionPerformed(ActionEvent ex) {

if(ex.getActionCommand().equals("登陸")) {

String name=text1.getText();

String password=text2.getText();

SqlCon sc = new SqlCon();

Connection conn=sc.getconnection();

PreparedStatement stmt=null;

ResultSet rs=null;

String sql="select * from admin where ADname=? and ADpwd=?";

try {

stmt=conn.prepareStatement(sql);

stmt.setString(1, name);

stmt.setString(2, password);

rs=stmt.executeQuery();

if(rs.next()){ //判斷數(shù)據(jù)集中是否有數(shù)據(jù),有則表明當(dāng)前輸入的用戶和密碼存在

this.setVisible(false);

new DataFrame();

}

else{

JOptionPane.showMessageDialog(null, "用戶名或密碼錯誤!!");

}

} catch (SQLException e) {

e.printStackTrace();

}

}

if(ex.getSource()==bt2) {

System.exit(0);

}

}

public static void main(String[] args) {

new Loginframe();

}

}

展開

總結(jié)

以上是生活随笔為你收集整理的java订单实现的_java订单系统的开发的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。