以下是引用mywisdom88在2018-1-30 11:54:35的发言:
比如你的数据结构是这样的
SQL表(id,字段1,字段2,字段3,日期)
你可以在最后或者最前,增加1个记录,就可以了.
select id,字段1,字段2,字段3,日期 from SQL表 where 日期='2018-01-29'
union all
select count(id),null,null,null,null from SQL表 where 日期='2018-01-29'
这样,就在最后1行,增加了1条记录,也就是你说的记录数,这个记录数,放在那行,就要看你具体情况了.
我的需求是要知道我查找出符合条件的资料共有几笔〜
之后才方便用循环〜
将每笔中选择的栏位资料加上HTML码(表格)〜
最后再邮寄出去〜
功能是使用者在网站内新增资料后〜系统能将使用者该日新增的资料寄出给相关人员〜
现在这三个需求不知道怎么组合〜最烂的方法是连续查三次〜
Protected Sub lbUpdata_Click(sender As Object, e As System.EventArgs) Handles lbUpdata.Click
Dim SQL As String
Dim ProjectItemCount As Integer = 0
Dim DHDate As String = Date.Today.Year & "-" & Date.Today.Month & "-" & Date.Today.Day
SQL = "SELECT * FROM [tblProjectDevpHistory] where [DHDate] = '" & DHDate & "' And [CreatorNo] = '" & Session("LoginNo") & "'" '取出当日该员变更专案项目
SQL = "SELECT DISTINCT [ProjectNo] FROM [tblProjectDevpHistory] where [DHDate] = '" & DHDate & "' And [CreatorNo] = '" & Session("LoginNo") & "'" '取出当日该员变更专案号码列表
SQL = "SELECT COUNT(*) FROM [tblProjectDevpHistory] where [DHDate] = '" & DHDate & "' And [CreatorNo] = '" & Session("LoginNo") & "'" '计算取出当日该员变更专案项目数量
Try
SqlDataSource1 = New SqlDataSource
SqlDataSource1.ProviderName = strDbType
SqlDataSource1.ConnectionString = WebConfigurationManager.ConnectionStrings(strCnnType & "DbAAA").ConnectionString
SqlDataSource1.SelectCommand = SQL
SqlDataSource1.DataSourceMode = SqlDataSourceMode.DataSet
args = New DataSourceSelectArguments
Dim my_DV As Data.DataView = SqlDataSource1.Select(args)
lvManufactureFT_AList.DataSource = my_DV
'???
Catch ex As Exception
Dim strErr As String = "●●● 程式错误讯息如下●●●" & "\n\n" & Replace(Replace(Replace(Replace(Trim(ex.ToString()), Chr(10), "") , Chr(13), ""), "\", "\\"), "'", "\'")
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('" & strErr & "');", True)
Finally
SqlDataSource1.Dispose()
End Try
End Sub