Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butto

这段代码 那里错了
Dim strsql As String
strsql = "select用户名,密码from用户表where用户名=" & TextBox1.Text & "and 密码 = " & TextBox2.Text & ""
Dim myconn As New OleDb.OleDbConnection
Dim mycomm As New OleDb.OleDbCommand
Dim myadpt As New OleDb.OleDbDataAdapter
Dim myds As New DataSet
Try
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("用户名不能为空!")
TextBox1.Focus()
TextBox2.Text = Nothing
Exit Sub
End If
myconn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=通讯录.mdb;fersist security info=false"
myconn.Open()
myconn = New System.Data.OleDb.OleDbConnection(strsql)
mycomm.CommandText = strsql
mycomm.Connection = myconn
myadpt.SelectCommand = mycomm
myadpt.Fill(myds)

SQL语句应该改为:
strsql = "select 用户名,密码 from 用户表 where 用户名='" & TextBox1.Text & "' and 密码 = '" & TextBox2.Text & "'"
温馨提示:内容为网友见解,仅供参考
无其他回答

VB.NET怎么编模拟袖珍计算器的完整程序?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim c As Char c = Trim(TextBox3.Text)Select Case c Case "+"TextBox4.Text = Val(TextBox1.Text) + Val(TextBox2.Text)Case "-"TextBox4.Text = Val(TextBox1.Tex...

vb.net程序,利用随机函数产生100个1到100之间的整数,求其中的最大最小...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Randomize() '产生随机数种子 以防止每次生成结果都一样 Dim a(100) As Integer '声明数组存放数据 用来保存随机数结果 Dim max As Integer, min As Integer '声明两个变量存...

用子程序结构编写如下程序:从键盘输入一个二位十进制的月份数(01~12...
Public Class Form1 Dim mon() As String = Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click On Error GoTo Handerr TextBox2.Text = mon(Val(TextBox1.Text))Exit Sub Handerr:MsgBox(mon(0))End Sub End Class ...黑龙...

vb.net 中单击button一次是一个事件再次点击又是另一个事件的代码是_百...
Dim i As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click i = i + 1 If i = 1 Then MsgBox("我是代码一") ElseIf i = 2 Then MsgBox("我是代码二" & Now) Else MsgBox("我是其他...

private sub button1_click(byvalsenderas system.object,byvaleassys...
1. 定义一个方法,button1_click(byvalsenderas system.object,byvaleassystem.eventargs) 包括返回值和输入参数,英文叫 Event Handler。2. 同时把该方法绑定在 buttON1.CLICK 事件上。另外 在VB.net 里事件定义是用关键字 Event 比如:Public Event SalarySecurityEvent(ByVal Sender As EmployeeWith...

VB通过文本框输入个人的姓名、通过单选按钮组输入性别和政治面貌,通 ...
Private Sub Button1_Click(ByVa l sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim aihao As String, Sex As String, zhengzhi As String aihao = "爱好:"Sex = "性别:"zhengzhi = "政治面貌:"If CheckBox1.Checked = True Then aihao = aihao + ...

这段vb代码怎么一直错的..急用啊
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cn As New SqlConnection("Initial Catalog=图书信息管理;data source=(local)")cn.open Dim sql As String = "select * from book where ???='" & textbook1.text &"'...

为什么提示语句在命名空间中无效
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ch $ Dim f2 As New Form2 ch $ =TextBox1.Text IF ch $ ="1215225"Then Me.Hide() f.show() El... 展开 18歳吥洅嗳朲 | 浏览4608 次 |举报 我有更好的答案推荐...

vb利用随机函数产生100个0到9之间的整数,统计一共产生了多少个0,多少...
'vb利用随机函数产生100个0到9之间的整数,统计一共产生了多少个0,多少个1,统计结果 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = ""Dim CountofZero As Integer = 0 Dim CountofOne As Integer = 0 Dim ...

vb输入学号或姓名可以查询该学生信息的程序
如果是:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click con1.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=学生表.mdb"con1.Open()com1.CommandText = "select * from 学生信息表 where 学号 like" & "...

相似回答