PDA

Click to See Complete Forum and Search --> : i need some help, what wrong with my code...?


tmashley
Jan 29th, 2003, 05:37 AM
Hi, i need some help... what is wrong
the report loads, but no data show on the chart, it "sums" the values. i need to display all the values...???


i need to produce a crytal report that
has a chart which displays
the data between certain date/time fields
depending on selected items
from an inSql database

code for getting data from inSql:

Dim strStart As String = txtStartDate.Value & " " & txtStartTime.Value
Dim strEnd As String = txtEndDate.Value & " " & txtEndTime.Value
Dim strItem1 As String = DropDownList1.SelectedItem.Value
Dim strItem1 As String = DropDownList2.SelectedItem.Value
Dim StartDate As DateTime
Dim EndDate As DateTime
Dim Item1 As String
Dim Item2 As String
Dim conDB = Server.CreateObject("ADODB.Connection")
conDB.Connectiontimeout = 300
conDB.Commandtimeout = 300
conDB.Open("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=vwUser;Data Source=Server1;Use Procedure for Prepare=0;Auto Translate=True;Packet Size=4096;User Id=vwUser;PASSWORD=Password;Initial Catalog=Database1;")
Dim rs = Server.CreateObject("ADODB.Recordset")
StartDate = CDate(strStart)
EndDate = CDate(strEnd)
Item1 = CStr(strItem1)
Item2 = CStr(strItem2)
rs.Open("Select * from InSQL.Database1.dbo.Table where (item = '" & strItem1 & "') or (item= '" & strItem2 & "')", conDB)


code for chart:

Dim CRCreport As New CrystalReport1()
CRCreport.SetDataSource(rs)
Fname = System.IO.Path.GetTempPath() & Session.SessionID.ToString & ".pdf"
crDiskFileDestinationOptions.DiskFileName = Fname
With CRCreport.ExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
CRCreport.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
System.IO.File.Delete(Fname)

RealNickyDude
Jan 29th, 2003, 10:46 AM
Dim strItem1 As String = DropDownList1.SelectedItem.Value
Dim strItem1 As String = DropDownList2.SelectedItem.ValuePerhaps that should that be:Dim strItem2 As String = DropDownList2.SelectedItem.Value?

Pirate
Jan 29th, 2003, 12:24 PM
maybe something rong with your sql statement , :rolleyes: ?