Results 1 to 3 of 3

Thread: i need some help, what wrong with my code...?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    128

    i need some help, what wrong with my code...?

    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:
    PHP Code:
            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:
    PHP Code:
    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

  2. #2
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    VB Code:
    1. Dim strItem1 As String = DropDownList1.SelectedItem.Value
    2. [b]Dim strItem1 As String = DropDownList2.SelectedItem.Value[/b]
    Perhaps that should that be:
    VB Code:
    1. Dim strItem[b]2[/b] As String = DropDownList2.SelectedItem.Value
    ?
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    maybe something rong with your sql statement , ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width