Foxtable(狐表)用户栏目专家坐堂 → 请问如何在SQL语句中使用数组或者集合


  共有8573人关注过本帖树形打印复制链接

主题:请问如何在SQL语句中使用数组或者集合

帅哥哟,离线,有人找我吗?
chenpan
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:133 积分:1199 威望:0 精华:0 注册:2012/4/18 9:54:00
请问如何在SQL语句中使用数组或者集合  发帖心情 Post By:2012/6/15 0:09:00 [显示全部帖子]

Dim cmd As New SQLCommand
Dim nt As DataTable
cmd.C
 'Dim thmc As String = e.Form.Controls("ComboBox1").Selecteditem

Dim scx As String=e.Form.Controls("ComboBox1").Selecteditem
Dim fg As new List (of String)
fg.AddRange (e.Form.Controls("CheckedComboBox1").Selecteditem)


Dim lrs As Date= e.Form.Controls("DateTimePicker1").value
Dim lre As Date= e.Form.Controls("DateTimePicker2").value

If  scx  Is Nothing And fg Is Nothing And e.Form.Controls("DateTimePicker1").value Is Nothing Or e.Form.Controls("DateTimePicker2").value Is Nothing Then
MessageBox.Show("无最基本的查询条件")
e.Form.Controls("ComboBox2").Select
ElseIf scx  IsNot Nothing And fg IsNot Nothing And e.Form.Controls("DateTimePicker1").value IsNot Nothing And e.Form.Controls("DateTimePicker2").value IsNot Nothing Then

cmd.CommandText = "Select  * from {日常废品录入} where {日常废品录入}.[录入时间] between #" & lrs & "# and #" & lre & " # And {日常废品录入}.[发生工序] IN '" &  e.Form.Controls("CheckedComboBox1").selecteditem  & " 'And {日常废品录入}.[生产线f] = '" & scx & "'"
nt= cmd.ExecuteReader()
ElseIf  scx  Is Nothing And fg IsNot Nothing And e.Form.Controls("DateTimePicker1").value IsNot Nothing And e.Form.Controls("DateTimePicker2").value IsNot Nothing Then
cmd.CommandText = "Select  * from {日常废品录入} where {日常废品录入}.[录入时间] between #" & lrs & "# and #" & lre & "# And {日常废品录入}.[发生工序] IN'" & e.Form.Controls("CheckedComboBox1").Selecteditem & "'"
nt= cmd.ExecuteReader()
ElseIf scx  IsNot Nothing And fg Is Nothing And e.Form.Controls("DateTimePicker1").value IsNot Nothing And e.Form.Controls("DateTimePicker2").value IsNot Nothing Then
cmd.CommandText = "Select  * from {日常废品录入} where {日常废品录入}.[录入时间] between #" & lrs & "# and #" & lre & "#  And {日常废品录入}.[生产线f] = '" & scx  & "'"
nt= cmd.ExecuteReader()
ElseIf scx  Is Nothing And fg Is Nothing And e.Form.Controls("DateTimePicker1").value IsNot Nothing And e.Form.Controls("DateTimePicker2").value IsNot Nothing Then
cmd.CommandText = "Select  * from {日常废品录入} where {日常废品录入}.[录入时间] >= #" & lrs & "# and {日常废品录入}.[录入时间] <= #" & lre &  "# "
nt= cmd.ExecuteReader()
Else
MessageBox.Show("查询出错,请改变查询条件")

End If

 

Tables("废品流水表查询_Table1").DataSource =nt
DataTables("废品流水表查询_Table1").DataCols.Add("废品总重" ,Gettype(Double), "[单重]*[废品数量] ")
Tables("废品流水表查询_Table1").Cols("废品总重").Move(5)
'DataTables("废品流水表查询_Table1")


'e.Form.Controls("Table1").Visible=True
Tables("废品流水表查询_Table1").AutoSizeCols()
Tables("废品流水表查询_Table1").Cols("废品描述").Width=100
DataTables("废品流水表查询_Table1").dataCols("废品总重").SetFormat("#,###.0")
DataTables("废品流水表查询_Table1").dataCols("生产线f").Caption ="生产线"
DataTables("废品流水表查询_Table1").dataCols("材质规格f").Caption="材质规格"
DataTables("废品流水表查询_Table1").dataCols("订货单位f").Caption="订货单位"

 

 

 请问如何在SQL语句中使用数组或者集合?

 

 

[此贴子已经被作者于2012-6-15 0:10:24编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
chenpan
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:133 积分:1199 威望:0 精华:0 注册:2012/4/18 9:54:00
  发帖心情 Post By:2012/6/15 10:59:00 [显示全部帖子]

狐爸你好,用了你的方法,好像不行!

 回到顶部