小弟我遇到的有关问题记录帖
我遇到的问题记录帖
dataset中查询并返回id号
If TextBox5.Text.Trim = "" Then
MsgBox("测试方案的名称不能为空!")
Exit Sub
End If
If TextBox2.Text.Trim = "" Then
MsgBox("建立人姓名不能为空!")
End If
If TextBox3.Text.Trim <> TextBox4.Text.Trim Then
MsgBox("密码不一致!")
End If
'---------------
Dim connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\My Documents\zbq666Access.accdb;Persist Security Info=True;Jet OLEDB:Database Password=nihaoma"
Dim con As OleDbConnection = New OleDbConnection(connstring)
con.Open()
Dim Sql As String = "select * from [发送器建立的方案] where [方案名称]='" & Me.TextBox1.Text.Trim & "'"
Dim cmd = New OleDbCommand(Sql, con)
Dim ad As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim dt As DataTable = New DataTable("chazhao")
If ad.Fill(dt) = 0 Then
MsgBox("dd")
Else
MsgBox("已经存在此方案!")
Exit Sub
End If
con.Close()
con.Dispose()
'----------------------
Dim dr As DataRow = Zbq666AccessDataSet1.发送器建立的方案.New发送器建立的方案Row
dr(0) = "45"
dr(1) = Me.TextBox5.Text.Trim
Zbq666AccessDataSet1.发送器建立的方案.Add发送器建立的方案Row(dr)
------解决方案--------------------
Dim Sql As String = "select * from [发送器建立的方案] where [方案名称]='" & Me.TextBox1.Text.Trim & "'"
的'改成英文的'
dataset中查询并返回id号
If TextBox5.Text.Trim = "" Then
MsgBox("测试方案的名称不能为空!")
Exit Sub
End If
If TextBox2.Text.Trim = "" Then
MsgBox("建立人姓名不能为空!")
End If
If TextBox3.Text.Trim <> TextBox4.Text.Trim Then
MsgBox("密码不一致!")
End If
'---------------
Dim connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\My Documents\zbq666Access.accdb;Persist Security Info=True;Jet OLEDB:Database Password=nihaoma"
Dim con As OleDbConnection = New OleDbConnection(connstring)
con.Open()
Dim Sql As String = "select * from [发送器建立的方案] where [方案名称]='" & Me.TextBox1.Text.Trim & "'"
Dim cmd = New OleDbCommand(Sql, con)
Dim ad As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim dt As DataTable = New DataTable("chazhao")
If ad.Fill(dt) = 0 Then
MsgBox("dd")
Else
MsgBox("已经存在此方案!")
Exit Sub
End If
con.Close()
con.Dispose()
'----------------------
Dim dr As DataRow = Zbq666AccessDataSet1.发送器建立的方案.New发送器建立的方案Row
dr(0) = "45"
dr(1) = Me.TextBox5.Text.Trim
Zbq666AccessDataSet1.发送器建立的方案.Add发送器建立的方案Row(dr)
------解决方案--------------------
Dim Sql As String = "select * from [发送器建立的方案] where [方案名称]='" & Me.TextBox1.Text.Trim & "'"
的'改成英文的'