falconsight
Programmer
I'm using VB6 and the Crystal Reports controls that come with Visual Studio 6. My system runs WinXP SP2. My database is SQLServer 2005
I'm generating a report based on a view that already exists on the server.
The query string that works goes like this:
It goes on a crosstab report, that access data thru a .ttx
When I try to use the expression
on the same report the program doesn't crash, but it sends a message "Unable to access first record" an then "SQL Server error"
If you try both expressions on SQL Server, they both work, and the data are shown, so I assume is not an error on the database. Same with the expression created by VB. They prove thru.
Also, if I issue the command for a date range that has not data, the report works, showing a blank report with all the headers and footers.
I've tried to select the data with/without "order by" and specifically naming each field in SqlX, to no result.
Please some ideas!
I'm generating a report based on a view that already exists on the server.
The query string that works goes like this:
Code:
dim rsrepo as new ADODB.recordsource
dim sqlx as string
dim reporte as new programacion
sqlx = "select * from vprogramarev where fecha between convert(datetime,'" + Format(dtpFechaDesde.Value, "yyyymmdd") + "') and convert(datetime,'" + Format(dtpFechaHasta.Value, "yyyymmdd") + "')"
rsRepo.Open Sqlx, ConActiva, adOpenDynamic, adLockReadOnly
reporte.DiscardSavedData
reporte.Database.SetDataSource rsRepo
CRViewer1.ReportSource = reporte
CRViewer1.ViewReport
It goes on a crosstab report, that access data thru a .ttx
When I try to use the expression
Code:
select * from vprogramarev where fecharev between convert(datetime,'" + Format(dtpFechaDesde.Value, "yyyymmdd") + "') and convert(datetime,'" + Format(dtpFechaHasta.Value, "yyyymmdd") + "')"
on the same report the program doesn't crash, but it sends a message "Unable to access first record" an then "SQL Server error"
If you try both expressions on SQL Server, they both work, and the data are shown, so I assume is not an error on the database. Same with the expression created by VB. They prove thru.
Also, if I issue the command for a date range that has not data, the report works, showing a blank report with all the headers and footers.
I've tried to select the data with/without "order by" and specifically naming each field in SqlX, to no result.
Please some ideas!