以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]着急呀,错误在哪里  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=45145)

--  作者:wuxianzuoji41
--  发布时间:2014/1/16 19:18:00
--  [求助]着急呀,错误在哪里

计划管理里填写如下代码,老是提示“索引超出数组界限”

这个错在在哪里,以前放在窗口里没问题

 

Dim cmd As New SQLCommand
cmd.C
\'

cmd.C
Dim dt2 As DataTable
Dim dr2 As DataRow
cmd.CommandText = "Select top 1 * From crm_customer_track where  creator<>" & _userid & " and track_user=" &  _userid &" Order by track_id desc"
dt2 = cmd.ExecuteReader
dr2 = dt2.DataRows(0)
If GeninShuliang<>dr2("track_id") Then


Dim dt3 As DataTable
Dim dr3 As DataRow
cmd.CommandText = "Select emp_name From pub_user where  user_id=" & dr2("creator")
dt3 = cmd.ExecuteReader
dr3 = dt3.DataRows(0)


If  dr2("next_time")>= Date.Today  And dr2("next_time") <Date.Today.AddDays(1) Then


nfi.BalloonTipTitle=dr3("emp_name") & "给你发来今天需要处理的内容为:"
nfi.BalloonTipText =dr2("track_note")

nfi.ShowBalloonTip(300000) \'提示显示的事件(毫秒)

End  If
GeninShuliang=dr2("track_id")
End If

[此贴子已经被作者于2014-1-16 19:22:48编辑过]

--  作者:有点甜
--  发布时间:2014/1/16 19:32:00
--  
加入判断

Dim cmd As New SQLCommand
cmd.C\'
cmd.C
Dim dt2 As DataTable
Dim dr2 As DataRow
cmd.CommandText = "Select top 1 * From crm_customer_track where  creator<>" & _userid & " and track_user=" &  _userid &" Order by track_id desc"
dt2 = cmd.ExecuteReader
If dt2.DataRows.Count <= 0 Then
    msgbox("没有查到数据")
Else
    dr2 = dt2.DataRows(0)
    If GeninShuliang<>dr2("track_id") Then
        
        Dim dt3 As DataTable
        Dim dr3 As DataRow
        cmd.CommandText = "Select emp_name From pub_user where  user_id=" & dr2("creator")
        dt3 = cmd.ExecuteReader
        If dt3.DataRows.Count <= 0 Then
            msgbox("没有查到数据")
        Else
            dr3 = dt3.DataRows(0)
            
            If  dr2("next_time")>= Date.Today  And dr2("next_time") <Date.Today.AddDays(1) Then
                
                nfi.BalloonTipTitle=dr3("emp_name") & "给你发来今天需要处理的内容为:"
                nfi.BalloonTipText =dr2("track_note")
                nfi.ShowBalloonTip(300000) \'提示显示的事件(毫秒)
            End  If
            GeninShuliang=dr2("track_id")
        End If
    End If
End If

--  作者:逛逛
--  发布时间:2014/1/16 20:46:00
--  

Dim cmd As New SQLCommand
cmd.C
\'

cmd.C

 

 

如果是两个数据源,要分开写

Dim cmd As New SQLCommand

Dim cmd1 As New SQLCommand
cmd.C
\'

cmd1.C