用C#语言做登录系统出错!求指导

.Net技术 码拜 8年前 (2016-02-25) 886次浏览
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace 家乐福物流配送管理信息系统
{
public partial class Form1 : Form
{
string strSql;
OleDbDataAdapter adap = new OleDbDataAdapter();
DataSet1 ds = new DataSet1();
Form2 frm2 = new Form2();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string strSq1 = “Select * from 员工表 where 员工编号=”” + textBox1.Text + “” and 密码口令=”” + textBox2.Text + “””;
OleDbConnection conn = new OleDbConnection(“Provider=Microsoft.ACE.OLEDB.12.0;Data Source=用户.accdb”);
conn.Open();
adap.SelectCommand = new OleDbCommand(strSql, conn);
adap.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
string zf = ds.Tables[0].Rows[0][“所属门店/总店”].ToString();
string bm = ds.Tables[0].Rows[0][“所属部门”].ToString();
if (zf == “总店”)
{
if (bm == “采购部门”)
{
MessageBox.Show(“欢迎你,” + textBox1.Text);
this.Hide();
frm2.ShowDialog();
this.Show();
}
else
{
MessageBox.Show(“用户不存在或密码错误”);
return;
}
}
else
{
MessageBox.Show(“用户不存在或密码错误”);
return;
}
}
conn.Close();
}
}
}
希望能通过员工表中【所属门店/总店】【所属部门】这两个字段的判定来进行跳转不同的界面!
解决方案

20

    if (zf == “总店”)  第一个假如是假,就应该判断该员工所在店面有误,请选择正确店面

30

LZ把错误贴出来看看。你这问题虽然应该很简单,但是哪里错了你没说清楚。我们也不好根据代码去猜,你把错误贴出来帮你看看

10

数据库查询 sql语句

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明用C#语言做登录系统出错!求指导
喜欢 (0)
[1034331897@qq.com]
分享 (0)