连接不上accesss数据库
时间:2011-12-12
来源:互联网
Imports System.Data.SqlClient
Public Class 用户登录
Dim sqlcon As New SqlConnection()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As String = "data source=.;connect timeout=5;User ID=sa;Password='123';initial catalog=POS收银系统;"
sqlcon.ConnectionString = conn
sqlcon.Open()
Dim sqlcom As New SqlCommand
sqlcom.CommandText = "select * from 用户信息 where 用户名='" & TextBox1.Text & " ' and 用户密码='" & TextBox2.Text & " 'and 用户类型='" & ComboBox1.Text & " ' "
sqlcom.Connection = sqlcon
Dim myds As New DataSet
Dim myadapter As New SqlDataAdapter
myadapter.SelectCommand = sqlcom
myadapter.Fill(myds, "a")
If ComboBox1.Text = "" Then
MsgBox("请选择用户类型!", MsgBoxStyle.Information, "超市管理系统")
ElseIf myds.Tables("a").Rows.Count = 0 Then
MsgBox("用户名或密码错误,请从新输入!", MsgBoxStyle.Information, "超市管理系统")
Else
pos系统主界面.Show()
Me.Hide()
MsgBox("你好!你已成功登录!", MsgBoxStyle.Information, "超市管理系统")
End If
sqlcon.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Close()
End Sub
Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
If ComboBox1.Text = "超级管理员" Then
clearr()
Button1.Enabled = True
TextBox1.Enabled = True
TextBox2.Enabled = True
End If
If ComboBox1.Text = "普通管理员" Then
clearr()
Button1.Enabled = True
TextBox1.Enabled = True
TextBox2.Enabled = True
End If
If ComboBox1.Text = "普通员工" Then
clearr()
Button1.Enabled = False
TextBox1.Enabled = False
TextBox2.Enabled = False
pos系统主界面.Show()
Me.Hide()
MsgBox("欢迎进入!", MsgBoxStyle.Information, "超市管理系统")
End If
If ComboBox1.Text = "提货员" Then
clearr()
Button1.Enabled = True
TextBox1.Enabled = True
TextBox2.Enabled = True
End If
If ComboBox1.Text = "进货员" Then
clearr()
Button1.Enabled = True
TextBox1.Enabled = True
TextBox2.Enabled = True
End If
End Sub
Sub clearr()
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class
Dim conn As String = "data source=.;connect timeout=5;User ID=sa;Password='123';initial catalog=POS收银系统;"
access没设密码 连接还要密码吗?
作者: LANGZI7758521 发布时间: 2011-12-12
作者: caozhy 发布时间: 2011-12-12
作者: LANGZI7758521 发布时间: 2011-12-12
作者: lary_li 发布时间: 2011-12-12
作者: lary_li 发布时间: 2011-12-12
帮顶。。。
作者: cherish_55 发布时间: 2011-12-12
作者: zhouxingyu_kingstar 发布时间: 2011-12-12
作者: dhlb 发布时间: 2011-12-12
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\用户信息.mdb;JET Database: Password= 123456; Persist Security Info=False;")
MyConnection.Open() '找不到可安装的 ISAM。 索引循序存取法(Index Sequential Access Mode
作者: LANGZI7758521 发布时间: 2011-12-12
作者: jinhetian 发布时间: 2011-12-12
控件鼠标连接access ,连接完之后,可以通过 accessdatasource 的属性 connectstring
查看表达式
作者: wyl1108 发布时间: 2011-12-14
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28