动态登录基于accdb数据库的登录表单? [英] dynamic login based on accdb database for login form?

查看:67
本文介绍了动态登录基于accdb数据库的登录表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按钮上有此代码,用于登录和打开主表单

KorisnikLozinkaString是基于数据集构建的sql,在该数据库中可以正常运行. 数据源是具有用户名和密码的accdb数据库


Korisnik是用户名
Lozinka是密码

I have this code on button to login and open main form

KorisnikLozinkaString is sql built on dataset and it works fine there.
datasource is accdb database which has usernames and passwords


Korisnik is username
Lozinka is password

private void button1_Click(object sender, EventArgs e)

dynamic login = this.usersTableAdapter2.KorisnikLozinkaString(textBox1.Text, textBox2.Text);

{
if (login == null)
MessageBox.Show("Wrong Entry");
}

???????



而且我不知道如何使其工作,我需要将打开的if或else语句允许登录并打开主表单.

help



and I don''t know how to make it to work, I need the if or else statement that will open allow logging in and opening main form.

help

推荐答案

很难不知道KorisnikLozinkaString 方法的作用就知道自己在做什么.
It''s hard to know what you are doing without seeing what the KorisnikLozinkaString method does.


我找到了一个简单的解决方案,就在我眼前:

private void button1_Click(对象发送者,EventArgs e)
{
动态登录= this.usersTableAdapter2.KorisnikLozinkaString(textBox1.Text,textBox2.Text);
如果(登录== null)
{
MessageBox.Show(错误的条目");
}
其他
{
MessageBox.Show(成功登录);
mainForm main = new MainForm();
main.Show();
this.Hide();
}
I found a solution, easy one, right in front of my eyes:

private void button1_Click(object sender, EventArgs e)
{
dynamic login = this.usersTableAdapter2.KorisnikLozinkaString(textBox1.Text, textBox2.Text);
if (login == null)
{
MessageBox.Show("Wrong entry");
}
else
{
MessageBox.Show(Succesfull login");
mainForm main = new MainForm();
main.Show();
this.Hide();
}


这篇关于动态登录基于accdb数据库的登录表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆