相关代码如下:(其中num设置为text和ntext或者varchar和nvarchar问题依然存在)希望懂的大哥大姐帮帮忙,我QQ897830717:谢谢了。
class ActionHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String str1,str2,sqlStr;
Object obj = e.getSource();
//获得文本框和密码框的数据
str1 = jtflduser.getText().trim();
str2 = new String(jtpwdfld.getPassword()).trim();
try{
//单击[确定]按钮
if(obj.equals(OK_btn)){
if(obj.equals(""))
{
JOptionPane.showMessageDialog(frame,"用户不能为空!");
return;
}
//创建数据库连接
Jdbcfile conn = new Jdbcfile();
//产生登入SQL语句
sqlStr = "select * from Admin where num = '" + str1 + "' and password = '" + str2 + "' ";
ResultSet result = conn.executeQuery(sqlStr);
if(result.next())
class ActionHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String str1,str2,sqlStr;
Object obj = e.getSource();
//获得文本框和密码框的数据
str1 = jtflduser.getText().trim();
str2 = new String(jtpwdfld.getPassword()).trim();
try{
//单击[确定]按钮
if(obj.equals(OK_btn)){
if(obj.equals(""))
{
JOptionPane.showMessageDialog(frame,"用户不能为空!");
return;
}
//创建数据库连接
Jdbcfile conn = new Jdbcfile();
//产生登入SQL语句
sqlStr = "select * from Admin where num = '" + str1 + "' and password = '" + str2 + "' ";
ResultSet result = conn.executeQuery(sqlStr);
if(result.next())
解决方案 »
- 怎么把这个时间字符串格式化成long格式
- 你们的jdk是什么版本,java 6 update 10以后的哪种比较稳定
- java代码混淆器ProGuard使用问题
- case语句后常量表达式的值为什么不能是实数?如1.1?
- 对应于数据库中的 Date的 java数据类型是 什么?
- 变量传值问题`
- Statement.executeUpdate返回值的问题.
- (求算法)在一个二叉查找树中找到某一指定的值?
- 调查:准备学Java,可是Java能做什么呢?
- Java 问题: 用两个按钮分别为上一页,下一页,来控制 JTextArea,如何实现滚动条通过点击上下页按钮来
- 关于获取XML中的数据
- 关于XML菜鸟问题
记得要导入数据库驱动包