Dim cmd1 As New SQLCommand
Dim dt1 As Date
cmd1.C
cmd1.CommandText = "Select GetDate()"
dt1 = cmd1.ExecuteScalar()
e.DataRow("制单日期") = dt1.Date
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "SELECT * From {采购申请单主明细} where 制单日期 = '" & dt1.Date & "'"
dt = cmd.ExecuteReader()
Dim x As Integer = dt.DataRows.Count + 1
e.DataRow("单据编号") = "请-" & Format(dt1.Date,"yyMMdd") & "-" & Format (x,"00")
这是我的 放在新增行事件中