这是vb代码:
Dim strTracking As String = _
"SELECT convert(varchar(10),DateAdd(SS, measurement_time, '1970-01-01 02:00:00'), 111) + ' ' + convert(varchar(5),DateAdd(SS, measurement_time, '1970-01-01 02:00:00'), 108) as measurement_time, " & _
" blah, blah, blah, blah, blah, blah, blah, blah" & _
"FROM dbo.something" & _
"WHERE blahLIKE '" & something & "'" & _
"and ((something > '" & something & "' AND something <'" & something & "')) "
Dim DRBR As DataTable = osql.GetGen(oPack.oConnPack, strTracking)
If DRBR.Rows.Count > 0 Then
For i = 0 To DRBR.Rows.Count - 1
If i < 999 Then
Tracking(i, 0) = DRBR.Rows(i)("measurement_time")
Tracking(i, 1) = DRBR.Rows(i)("blah")
..etc...
End If
Next
Else
End If
好的,简单明了。现在,如果我在sql server上运行该sql查询,它将返回:
Measurement Time Blah Blah Blah
2016-11-01 14:31 x y z
2016-11-01 16:11 w q e
2016-11-01 16:15 f d rd
但是当该vb代码运行时(所有应该发生的事情都是将查询结果生成到基本报告中),报告将返回:
Measurement Time Blah Blah Blah
**2016-11-01 14:31** x y z
**2016-11-01 14:31** w q e
**2016-11-01 14:31** f d rd
请注意,其余行的日期和时间保持不变。
有人可以帮助我,我没有选择,也不知道如何解决这个问题!
编辑:
以下是获取数据的代码部分:
For rowcount = 0 To 999
If Not IsDBNull(Tracking(rowcount, 0)) Then
If Tracking(rowcount, 0) > " " Then
FinalDT.Rows.Add _
( _
Tracking(rowcount, 0), _
Tracking(rowcount, 1), _
Tracking(rowcount, 2), _
Tracking(rowcount, 3), _
Tracking(rowcount, 4), _
Tracking(rowcount, 5), _
Tracking(rowcount, 6), _
Tracking(rowcount, 7), _
Tracking(rowcount, 8) _
)
Else
rowcount = 999
End If
Else
rowcount = 999
End If
Next
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.ProcessingMode = ProcessingMode.Local
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report_Name.rdlc")
Dim ds As New DataSet
ds.Tables.Add(FinalDT)
Dim datasourcetest = New ReportDataSource("Report_Name_DataTable1", ds.Tables(0))
ReportViewer1.LocalReport.DataSources.Add(datasourcetest)
ReportViewer1.DataBind()
不幸的是,这包括简单的ReportViewer功能。 - 但我必须使用它。