当我在其他系统上运行Vb.Net项目时,我在Con.Open()中出错 [英] I Am Having An Error In Con.Open() When I Am Running The Vb.Net Project On Other Systems

查看:85
本文介绍了当我在其他系统上运行Vb.Net项目时,我在Con.Open()中出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是用于验证来自访问数据库的用户名和密码的登录页面代码

This is login page code for verifying username and password from access database

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       If TextBox1.Text = "" Or TextBox2.Text = "" Then
           MsgBox("ENTER USERNAME OR PASSWORD", MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation)

       else
       If ask() = True Then
           Employee.Show()
       Else
           MsgBox("INCORRECT USERNAME OR PASSWORD", MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation)
           End If
       End If
   End Sub

   Private Sub LoginForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       con.ConnectionString = "provider= microsoft.jet.oledb.4.0;data source = ..\debug\EmployeeFullDataBase.mdb"
   End Sub

   Public Function ask()
       Dim dt As New DataTable
       Dim ds As New DataSet
       ds.Tables.Add(dt)
       con.Open()
       Dim da As New OleDbDataAdapter("Select * from EmployeeFullData", con)
       da.Fill(dt)

       For Each DataRow In dt.Rows
           If TextBox1.Text = DataRow.item(11) And TextBox2.Text = DataRow(12) Then
               con.Close()
               Return True
           End If
       Next

       con.Close()
       Return False

   End Function

推荐答案

最可能的罪魁祸首是系统类型:如果它是64位,则没有64位版本的JET数据库引擎,因此连接将失败。



请尝试使用ACE引擎,并确保安装软件中包含DLL。



请不要存储密码明文 - 这是一个重大的安全风险。有关如何在此处执行此操作的信息:密码存储:如何做到这一点。 [ ^ ]



在许多国家,这是一种死罪: CommitStrip [ ^ ] - 或者它应该是。
The most likely culprit is the system type: if it's 64bit, then there is no 64bit version of the JET database engine, so the connection will fail.

Try using the ACE engine instead, and make sure that the DLL(s) are included in your installation software.

And please, never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^]

It's a capital crime in many countries: CommitStrip[^] - or it should be.


这篇关于当我在其他系统上运行Vb.Net项目时,我在Con.Open()中出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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