• 主页
  • VBS
  • .NET技术
  • VBA
  • VB网络编程
  • VB多媒体
  • VB数据库
  • VB控件
  • VB COM/DCOM
  • VB基础类
  • VB API
G36822 2014年01月26日
联合查询
数据库用的是ACCESS,查询语句在ACCESS中正常,但在VB.NET中提示“其他信息: ORDER BY 子句语法错误。”
代码如下:
    Private Sub FillCustomersAccounts()
strCustomersAccountsSQL = "Select Customer, EarningDate as AccountDate, Description as Desc, Amount as DR, 0 as CR From " &
"tblCustomersEarns Where EarningDate Between #2014-1-1# And #2014-1-31# " &
"UNION ALL Select Customer, OrderDate as AccountDate, Remark as Desc, 0 as DR, Account as CR From " &
"S:\Order.accdb.tblOrder Where OrderDate Between #2014-1-1# And #2014-1-31#"
conCustomer.Open()
Dim CustomersAccountsDataAdapt As New OleDb.OleDbDataAdapter(strCustomersAccountsSQL, conCustomer)
Dim CustomersAccountsDataset As New DataSet
CustomersAccountsDataAdapt.Fill(CustomersAccountsDataset, "CustomersAccounts")
dgvCustomerAccount.DataSource = CustomersAccountsDataset
dgvCustomerAccount.DataMember = "CustomersAccounts"
conCustomer.Close()
End Sub


求大神正解。
...全文
145 点赞 收藏 4
写回复
4 条回复

还没有回复,快来抢沙发~

发动态
发帖子
VB
创建于2007-09-28

1.1w+

社区成员

11.0w+

社区内容

VB技术相关讨论
社区公告
暂无公告