首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VB.NET余项函数

VB.NET余项函数
EN

Stack Overflow用户
提问于 2013-07-29 16:03:49
回答 1查看 535关注 0票数 0

我要做的是让每50个字符串读一行文字。我试图在GlobalVariables.TransferTracker接口上找到一个reaminder函数,但是我在网上找不到任何东西。有这样的功能吗?或者用一种不同的方法做这件事?如果有帮助的话,这是我的代码:

代码语言:javascript
复制
       Do While TransferRecord.Read()

            'Start of writing to the SQL server.
            SQLServerConnection.Open()

            'SQL statement to transfer all the data that fits the requirements to the SQL server.
            Dim SQLCommand1 As New SqlCommand("INSERT INTO dbo.b_Pulp_PI_Forte (" & _
                                              "mill, " & _
                                              "keyprinter_datetime, " & _
                                              "bale_line_num, " & _
                                              "pulp_line_id, " & _
                                              "bale_id, " & _
                                              "drop_datetime, " & _
                                              "layboy_position, " & _
                                              "bale_gross_weight, " & _
                                              "gross_value_flag, " & _
                                              "bale_airdry_pct, " & _
                                              "airdry_value_flag, " & _
                                              "sheets_per_bale, " & _
                                              "grader_test_flag, " & _
                                              "dropped_num, " & _
                                              "created_by, " & _
                                              "CreatedDateTime, " & _
                                              "Who_did_it, " & _
                                              "Last_change_datetime) " & _
                                              "VALUES (" & _
                                              "'850', " & _
                                              "'" & ProdDate & "', " & _
                                              "'" & BaleLineNum & "', " & _
                                              "'" & BaleLine & "', " & _
                                              "'" & BaleNumber & "', " & _
                                              "'" & ProdDate & "', " & _
                                              "'0', " & _
                                              "'" & GrossWeight & "', " & _
                                              "'" & GrossWeightFlag & "', " & _
                                              "'" & AirDry & "', " & _
                                              "'" & AirDryFlag & "', " & _
                                              "'0', " & _
                                              "'N', " & _
                                              "'0', " & _
                                              "'BaleTrac', " & _
                                              "'" & Date.Now & "', " & _
                                              "'BaleTrac', " & _
                                              "'" & Date.Now & "')")

            'If DisplayCode is checked this will be printed to the screen.
            If ApplicationPropertiesWindow.DisplayCodechkbx.Checked = True Then
                MainTextBox.AppendText(Environment.NewLine & SQLCommand1.CommandText)
                GlobalVariables.DisplayCode = True
            End If

            'Executing the SQL statement.
            SQLCommand1.Connection = SQLServerConnection
            SQLCommand1.ExecuteNonQuery()
            SQLServerConnection.Close()
            GlobalVariables.TransferTracker = GlobalVariables.TransferTracker + 1

            'This is where I would like to have the remainder function.
            'Making message to show that program is still running.
            If GlobalVariables.TransferTracker = 50 Then
                MainTextBox.AppendText(Environment.NewLine & "50 records transferred.")
            End If
        Loop

现在,我刚刚设置了它,这样它就会触发50条记录,因为我找不到这个函数。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-29 16:06:21

其余部分是VB,Mod中的一个运算符。

代码语言:javascript
复制
If GlobalVariables.TransferTracker Mod 50 = 0 Then …

作为一般建议,不要在您的条件下编写… = True。它的冗余是多余的。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17928748

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档