老师好,我想在商品名称列的字段中只取字符开头的一个字符(只取3个)谢谢老师。
Select e.DataCol.Name
Case "项目","商品名称"
If e.DataRow.IsNull("项目") OrElse e.DataRow.Isnull("商品名称") Then
e.DataRow("商品ID") = Nothing
Else
Dim lb As String = getpy(e.DataRow("项目"), True).toupper & "-" & getpy(e.DataRow("商品名称")) & "-"
Dim max As String = e.DataTable.Compute("Max(商品ID)","商品id like '" & lb & "%' And _Identify<> '" & e.DataRow("_Identify") & "'") '取得该类别的最大编号
Dim idx = 1
If max > "" Then
idx = cint(max.SubString(lb.length))+1
End If
e.DataRow("商品ID") = lb & format(idx, "000")
End If
End Select