以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]多表查询 从字符串“某某 到类型“Long”的转换无效  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=150055)

--  作者:celchentao
--  发布时间:2020/5/19 16:37:00
--  [求助]多表查询 从字符串“某某 到类型“Long”的转换无效
多表查询  代码如下


详细错误信息:
从字符串“Select {top_trade}.[top_xuhao],[”到类型“Long”的转换无效。
输入字符串的格式不正确。

 FI = "top_outer_sid LIKE \'J%\'" 指定这个条件后 报错

--  作者:celchentao
--  发布时间:2020/5/19 16:38:00
--  
Dim cnt As Integer = DataTables("代发货明细").DataRows.Count
Dim Filter As String
Dim FI As String
Filter = "top_seller_memo LIKE \'%" & e.Form.Controls("TextBox1").Value & "%\'"
FI = "top_outer_sid LIKE \'J%\'"



--  作者:celchentao
--  发布时间:2020/5/19 16:39:00
--  
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim sCols() As String = {"top_xuhao", "top_seller_nick", "top_tid","top_buyer_nick","top_plain_recv_name","top_plain_recv_mobile","top_receiver_state","top_receiver_city","top_receiver_district","top_plain_recv_addr","top_buyer_message","top_seller_memo","top_pay_time","top_synchro_time","top_sku_properties_name","top_outer_iid","top_outer_sid","top_num","top_shifu"}
Dim dCols() As String = {"序号", "发货单位", "订单号","旺旺名","收件人姓名","收件人电话","买家省份","买家城市","买家地区","收件人地址","买家留言","卖家备注","付款时间","下载日期","销售属性","商家编码","货号","发货数量","销售价"} 
cmd.C 


--  作者:celchentao
--  发布时间:2020/5/19 16:42:00
--  
完整代码发不了  我放附件  请求老师指点 
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:新建文本文档.txt


--  作者:有点蓝
--  发布时间:2020/5/19 17:08:00
--  
cmd.CommandText = "Select {top_trade}.[top_xuhao],[top_seller_nick],[top_print_logistics_time],{top_trade}.[top_tid],[top_buyer_nick],[top_receiver_name],[top_receiver_mobile],[top_receiver_phone],[top_receiver_state],[top_receiver_city],[top_receiver_district],[top_receiver_address],[top_company_name],[top_out_sid],[top_buyer_message],[top_seller_memo],[top_pay_time],[top_trade_from],[top_type],[top_consign_time],[top_synchro_time],[top_invoice_info],[top_title],[top_price],[top_num_iid],[top_sku_properties_name],[top_outer_iid],[top_outer_sid],[top_num],[top_shifu],[top_plain_recv_name],[top_plain_recv_mobile],[top_plain_recv_addr] From {top_order} Right top_outer_sid {top_trade} ON {top_trade}.[top_tid] = {top_order}.[top_tid] Where (" & Filter  & ") Or (" & FI & ")"
--  作者:celchentao
--  发布时间:2020/5/19 17:09:00
--  
我试试看 谢谢老师指点
--  作者:celchentao
--  发布时间:2020/5/19 17:13:00
--  
\'top_trade\' 附近有语法错误。
详细错误信息:
未将对象引用设置到对象的实例。
依然还是报错

--  作者:celchentao
--  发布时间:2020/5/19 17:14:00
--  
\'top_trade\' 附近有语法错误。
详细错误信息:
未将对象引用设置到对象的实例。
依然还是报错

不知是否 是多表查询 的 分别指定了两个表的条件的问题 

--  作者:celchentao
--  发布时间:2020/5/19 17:17:00
--  
Filter = "top_seller_memo LIKE \'%" & e.Form.Controls("TextBox1").Value & "%\'"
FI = "top_outer_iid Like \'J%\'"
cmd.CommandText = "S/elect {top_trade}.[top_xuhao],[top_seller_nick],[top_print_logistics_time],{top_trade}.[top_tid],[top_buyer_nick],[top_receiver_name],[top_receiver_mobile],[top_receiver_phone],[top_receiver_state],[top_receiver_city],[top_receiver_district],[top_receiver_address],[top_company_name],[top_out_sid],[top_buyer_message],[top_seller_memo],[top_pay_time],[top_trade_from],[top_type],[top_consign_time],[top_synchro_time],[top_invoice_info],[top_title],[top_price],[top_num_iid],[top_sku_properties_name],[top_outer_iid],[top_outer_sid],[top_num],[top_shifu],[top_plain_recv_name],[top_plain_recv_mobile],[top_plain_recv_addr] From {top_order} Right top_outer_sid {top_trade} ON {top_trade}.[top_tid] = {top_order}.[top_tid] Where (" & Filter & ") Or (" & FI & ")"


--  作者:celchentao
--  发布时间:2020/5/19 17:17:00
--  
S/elect  这个斜杠以去掉