以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [推荐][讨论] 提示找不到CRM_SALE,谁帮我找找错误  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=44097)

--  作者:wuxianzuoji41
--  发布时间:2013/12/23 9:28:00
--  [推荐][讨论] 提示找不到CRM_SALE,谁帮我找找错误

dim cmd as SQLCommand

\'核算上月工资_____________________________________________________________________________
Dim shangyue As Double=0
Dim y_Shangyue As Integer = Date.Today.Year
Dim m_Shangyue As Integer = Date.Today.Month
Dim dt1_Shangyue As New Date(y_Shangyue, m_Shangyue, 1)
dt1_Shangyue  = dt1_Shangyue.Addmonths(-1)
y_Shangyue = dt1_Shangyue.Year
m_Shangyue = Dt1_Shangyue.Month
Dim FilterShangyue  As String
Dim dt2_Shangyue  As New Date(y_Shangyue, m_Shangyue, Date.DaysInMonth(y_Shangyue, m_Shangyue)) \'获取本月的最后一天
FilterShangyue = "(sell_date >= \'" & dt1_Shangyue & "\' And sell_date <= \'" & dt2_Shangyue & "\')"
FilterShangyue= "select * from crm_sale left join crm_opportunity on crm_sale.opp_id=crm_opportunity.opp_id Where  seller = \'" & _userid & "\'and " + FilterShangyue
 e.Form.Controls("txtShangyueticheng").text=FilterShangyue
Dim dt As DataTable
cmd.CommandText = FilterShangyue
dt = cmd.ExecuteReader()
For Each dr2 As DataRow In dt.Datarows
msgbox(dr2("from_id"))
Select Case dr2("from_id")
Case 0,8
shangyue=shangyue+dr2("totalMoney")*0.005
Case 3,12,1,2,4,5,6,7,9,10,11
shangyue=shangyue+dr2("totalMoney")*0.02
Case Else
End Select
Next
e.Form.Controls("txtShangyueticheng").text=shangyue


--  作者:Bin
--  发布时间:2013/12/23 9:28:00
--  
建议您用这个方法:
http://www.foxtable.com/help/topics/1485.htm

先找出是哪一行出错,然后分析原因,搞不定,贴出代码,并告诉我们运行到哪一行出错,以及错误提示。

--  作者:wuxianzuoji41
--  发布时间:2013/12/23 9:57:00
--  
以下是引用Bin在2013-12-23 9:28:00的发言:
建议您用这个方法:
http://www.foxtable.com/help/topics/1485.htm

先找出是哪一行出错,然后分析原因,搞不定,贴出代码,并告诉我们运行到哪一行出错,以及错误提示。

Dim FilterShangyue  As String
Dim dt2_Shangyue  As New Date(y_Shangyue, m_Shangyue, Date.DaysInMonth(y_Shangyue, m_Shangyue)) \'获取本月的最后一天
FilterShangyue = "(sell_date >= \'" & dt1_Shangyue & "\' And sell_date <= \'" & dt2_Shangyue & "\')"
FilterShangyue= "select * from crm_sale left join crm_opportunity on crm_sale.opp_id=crm_opportunity.opp_id Where  seller = \'" & _userid & "\'and " + FilterShangyue
e.Form.Controls("txtShangyueticheng").text=FilterShangyue
Dim dt As DataTable
cmd.CommandText = FilterShangyue
dt = cmd.ExecuteReader()

 

就是到这句的话的时候提示错误 dt = cmd.ExecuteReader()提示提示找不到CRM_SALE

但是我吧e.Form.Controls("txtShangyueticheng").text=FilterShangyue 这个SQL的字符窜放在SQL命令行里是没有错误的


--  作者:Bin
--  发布时间:2013/12/23 10:03:00
--  
如果你用的是外部数据源,你并没有指定数据源.
--  作者:wuxianzuoji41
--  发布时间:2013/12/23 10:06:00
--  
以下是引用Bin在2013-12-23 10:03:00的发言:
如果你用的是外部数据源,你并没有指定数据源.

真晕,谢谢,就是这个问题。