以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何给新增的多行,同时赋值?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=93385)

--  作者:17777188
--  发布时间:2016/11/27 12:58:00
--  如何给新增的多行,同时赋值?
Dim max As String
Dim idx As Integer
    max = DataTables("项目合伙人明细表").Compute("Max(项目编号)")   
If max > "" Then  
    idx = CInt(max.Substring(4,3)) + 1 
Else 
    idx = 1
End If

Dim hhrcount As Integer = e.Form.Controls("TextBox1").value

Dim dr As Row
dr = Tables("项目合伙人明细表").AddNew(hhrcount)
dr("项目编号") = "hhxm" & Format(idx,"000")

===========
给项目编号赋值时,只能赋第一行,。  求给新增的多行同时赋值?怎么搞?

--  作者:17777188
--  发布时间:2016/11/27 13:58:00
--  
根据 狐狸爸爸的 帖子 http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=88397&skin=0 改成了,。

Dim max As String
Dim idx As Integer
    max = DataTables("项目合伙人明细表").Compute("Max(项目编号)")   
If max > "" Then  
    idx = CInt(max.Substring(4,3)) + 1 
Else 
    idx = 1
End If

Dim hhrcount As Integer = e.Form.Controls("TextBox1").value

Dim dr As Row
dr = Tables("项目合伙人明细表").AddNew(hhrcount)

For xmno As  Integer = 1 To idx
    dr("项目编号") = "hhxm" & Format(idx,"000")
Next

==========
还是不行~~~图片点击可在新窗口打开查看

--  作者:有点色
--  发布时间:2016/11/27 14:12:00
--  

Dim max As String
Dim idx As Integer
max = DataTables("项目合伙人明细表").Compute("Max(项目编号)")
If max > "" Then
    idx = CInt(max.Substring(4,3)) + 1
Else
    idx = 1
End If

Dim hhrcount As Integer = e.Form.Controls("TextBox1").value

Dim count As Integer = Tables("项目合伙人明细表").rows.count
Tables("项目合伙人明细表").AddNew(hhrcount)
For i As Integer = count To count+hhrcount-1
    Tables("项目合伙人明细表").Rows(i)("项目编号") = "hhxm" & Format(idx,"000")
Next


--  作者:17777188
--  发布时间:2016/11/27 14:31:00
--  
谢谢~~实现了~~
以下是引用有点色在2016/11/27 14:12:00的发言:

Dim max As String
Dim idx As Integer
max = DataTables("项目合伙人明细表").Compute("Max(项目编号)")
If max > "" Then
    idx = CInt(max.Substring(4,3)) + 1
Else
    idx = 1
End If

Dim hhrcount As Integer = e.Form.Controls("TextBox1").value

Dim count As Integer = Tables("项目合伙人明细表").rows.count
Tables("项目合伙人明细表").AddNew(hhrcount)
For i As Integer = count To count+hhrcount-1
    Tables("项目合伙人明细表").Rows(i)("项目编号") = "hhxm" & Format(idx,"000")
Next