How to display the last inserted records in crystal report

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 4789 Views - Last Post: 28 March 2013 - 06:23 AM Rate Topic: -----

#16 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1534
  • View blog
  • Posts: 4,933
  • Joined: 25-September 09

Re: How to display the last inserted records in crystal report

Posted 21 March 2013 - 08:26 AM

It is feasible based on the information you've given.

As long as that timestamp is exactly the same with all records entered in that session, you should be able to set a SelectionFormula for your CrystalReportViewer to only display rows that have that exact timestamp.

I guess I just thought you were in the process of trying your solution to see if it worked.
Was This Post Helpful? 0
  • +
  • -

#17 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1031
  • View blog
  • Posts: 4,013
  • Joined: 02-July 08

Re: How to display the last inserted records in crystal report

Posted 21 March 2013 - 08:38 AM

If the report has a parameter field, can you use the select expert to filter based on that. Then you pass that timestamp to this parameter field and your done. I don't have CR available here to test.
Was This Post Helpful? 0
  • +
  • -

#18 Adqusit  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 143
  • Joined: 02-March 13

Re: How to display the last inserted records in crystal report

Posted 21 March 2013 - 06:51 PM

But I said earlier that i don't know anything at all about timeStamp and how its gonna work. I did understand little bit that what timeStamp is doing but i can't do it right now so easily.


1). The way which i have shown, isn't it right?

and secondly, how to work with TimeStamp? I really want to learn it and i have to submit my project so immediately.
Was This Post Helpful? 0
  • +
  • -

#19 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1534
  • View blog
  • Posts: 4,933
  • Joined: 25-September 09

Re: How to display the last inserted records in crystal report

Posted 21 March 2013 - 07:01 PM

Do a test for me.
Add 5 items.
Go to the database and do a screenshot of the last 5 items in the table.
Make sure we can see all the fields in the rows.

I need to see some real data because we're misunderstanding each other or something.
Was This Post Helpful? 0
  • +
  • -

#20 Adqusit  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 143
  • Joined: 02-March 13

Re: How to display the last inserted records in crystal report

Posted 22 March 2013 - 02:43 AM

Hi. This is the attached file.

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#21 Adqusit  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 143
  • Joined: 02-March 13

Re: How to display the last inserted records in crystal report

Posted 28 March 2013 - 06:23 AM

This is my form load event code. The form on which the Crystal Report Viewer, a textbox and a button is there.

Dim sel As String = "select top 1 Sale_Date from SaleInfo order by Sale_ID Desc"

        Dim cmdSql As New SqlCommand(sel, cnSql)
        cmdSql.CommandType = CommandType.Text
        daSql.SelectCommand = cmdSql
        daSql.Fill(dsSql, "SaleInfo")

        TextBox1.DataBindings.Add("text", dsSql, "SaleInfo.Sale_Date")


This code binds the last inserted record's Sale_Date in a textbox, Right.
After that i press the button (LoadMe), which is supposed to displayed the matched record on Crystal report.
this is my Button Click event code:

cnSql.Open()
        Dim sel As String = "select * from SaleInfo where Sale_Date = '" & TextBox1.Text & "'"
        Dim cmdSql As New SqlCommand(sel, cnSql)
        cmdSql.CommandType = CommandType.Text
        daSql.SelectCommand = cmdSql
        daSql.Fill(dsSql2, "SaleInfo")

        Dim objRpt As New CrystalReport1
        objRpt.SetDataSource(dsSql2.Tables("SaleInfo"))
        CrystalReportViewer2.ReportSource = objRpt
        CrystalReportViewer2.Refresh()
        cnSql.Close()


But it doesn't display anything. Please guide me that what is wrong with this code.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2