VB.NET access数据库 时间查询问题
(1)IfComboBox3.SelectedItem="出生年月"Then(2)express1=ComboBox3.SelectedItem+ComboBox4.Se...
(1) If ComboBox3.SelectedItem = "出生年月" Then
(2) express1 = ComboBox3.SelectedItem + ComboBox4.SelectedItem + "cdata('" + _ComboBox5.Text + "')"
Else
(4) express1 = ComboBox3.SelectedItem + ComboBox4.SelectedItem + "'" + ComboBox5.Text + "" '
End If
(5) If ComboBox6.SelectedItem = "出生年月" Then
(6) express2 = ComboBox6.SelectedItem + ComboBox7.SelectedItem + "cdata('" + _ComboBox8.Text + "')"
Else
(7) express2 = ComboBox6.SelectedItem + ComboBox7.SelectedItem + "'" + ComboBox8.Text + "" '
End If
(8) If RadioButton3.Checked Then logic = "and" Else logic = "or"
(9) If CheckBox1.Checked Then
express = express1 + logic + express2
Else
express = express1
End If
(10) OleDbDataAdapter1.SelectCommand.CommandText = "select * from 通信录 where" + express
Try
(11) OleDbDataAdapter1.Fill(newdataset)
Catch ex As Exception
MsgBox(ex.Message)
End Try
(12) DataGrid1.DataSource = newdataset.通信录
End Sub
以上程序的目的是为了实现数据库的查询 :查询两个日期(combobox6.text combobox8.tex)间所有的人,但我运行后会出现报错 共有两个问题
(2) 行 出会报 Cdata有问题,但我了解到 Cdata是个函数
(10) 行也有问题, 那个大侠给我说说这行该怎么改,谢谢! 展开
(2) express1 = ComboBox3.SelectedItem + ComboBox4.SelectedItem + "cdata('" + _ComboBox5.Text + "')"
Else
(4) express1 = ComboBox3.SelectedItem + ComboBox4.SelectedItem + "'" + ComboBox5.Text + "" '
End If
(5) If ComboBox6.SelectedItem = "出生年月" Then
(6) express2 = ComboBox6.SelectedItem + ComboBox7.SelectedItem + "cdata('" + _ComboBox8.Text + "')"
Else
(7) express2 = ComboBox6.SelectedItem + ComboBox7.SelectedItem + "'" + ComboBox8.Text + "" '
End If
(8) If RadioButton3.Checked Then logic = "and" Else logic = "or"
(9) If CheckBox1.Checked Then
express = express1 + logic + express2
Else
express = express1
End If
(10) OleDbDataAdapter1.SelectCommand.CommandText = "select * from 通信录 where" + express
Try
(11) OleDbDataAdapter1.Fill(newdataset)
Catch ex As Exception
MsgBox(ex.Message)
End Try
(12) DataGrid1.DataSource = newdataset.通信录
End Sub
以上程序的目的是为了实现数据库的查询 :查询两个日期(combobox6.text combobox8.tex)间所有的人,但我运行后会出现报错 共有两个问题
(2) 行 出会报 Cdata有问题,但我了解到 Cdata是个函数
(10) 行也有问题, 那个大侠给我说说这行该怎么改,谢谢! 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励20(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询