|
Dear All,
I have a report with a listbox of 5 coloumns, this report is loaded with a lot of records (600 rec). when the report is loads (in print priview) records beyond the length of the listbox are not shown.
how to make the report pages increase (multipage) and the listbox espand automaticaly as much as the number of records ??
Any Report control i can use so i can show all records returned from the query ??
Thanks
0 will always beats the 1.
modified on Wednesday, February 23, 2011 1:23 AM
|
|
|
|
|
hi..
The following is my Sp
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GettomoTaskSheet]
-- Add the parameters for the stored procedure here
@fname nvarchar(50)
AS
BEGIN
SET NOCOUNT ON;
SELECT date,To_Name ,Todays_Task,Status ,Tommorrows_Task,REPLACE(Comments, 'vinni','<font color="red">raki</font>') as comment
from TaskSheet where From_Name = @fname;
END
The above SP is used for displaying the data in SSRS reports ..
but when i run the SP in comment field where vinni occurs
i want raki in red color but it is displaying <font color="red">raki</font> this value.
i want to display the word raki in red color in ssrs2008 reports
please help me..
|
|
|
|
|
You are putting UI processing in the database query, wrong tool for the job. The data is interpreted as a string literal.
Move your UI code to RSS, there is a function area where you can put in the code to do that.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am having problems with executing a command object in ADO. The specific problem I have revolves around the proper type for the SQL string. Following examples on the internet, I established it with a _bstr_t. This though is not working with the * VARIANT type that is required in the Execute method. Can someone help me with the proper establishment of the SQL string? Listed below is the complete program:
Here is my error message coming out of the try block:
error C2664: 'ADODB::Command15::Execute' : cannot convert parameter 1 from '_bstr_t' to 'VARIANT *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
#include <stdio.h>
#include <string>
using std::string;
int cyc = 0;
#import "c:\program files\common files\system\ado\msado15.dll" rename ("EOF","EOFile")
using namespace std;
struct StartOLEProcess{
StartOLEProcess( ) {
::CoInitialize(NULL);
}
~StartOLEProcess( ) {
::CoUninitialize( );
}
} _start_StartOLEProcess;
void main(void)
{
ADODB::_ConnectionPtr con = NULL;
ADODB::_RecordsetPtr rec = NULL;
ADODB::_CommandPtr com = NULL;
ADODB::_ParameterPtr par = NULL;
bstr_t sConString;
bstr_t sSQLString;
HRESULT hr = S_OK;
VARIANT *vRecordsAffected = NULL;
hr = con.CreateInstance(__uuidof(ADODB::Connection));
hr = com.CreateInstance(__uuidof(ADODB::Command));
hr = par.CreateInstance(__uuidof(ADODB::Parameter));
hr = rec.CreateInstance(__uuidof(ADODB::Record));
printf("Connection object created.\n");
sConString = L"Provider=Microsoft.Jet.OLEDB.4.0;"
L"Data Source=C:\\Users\\Mike Certini\\Documents\\Trading\\Databases\\TradingAnalysis#2.mdb";
hr = con->Open(sConString, L"", L"", -1);
printf("Connection has been opened.\n");
_bstr_t strSQL("INSERT INTO mytable(id,desc)");
com->ActiveConnection = con;
com->CommandText = strSQL;
com->CommandType = ADODB::adCmdStoredProc;
VARIANT vtInt;
int intNum = 1;
vtInt.vt = VT_I2;
vtInt.iVal = intNum;
VARIANT vText;
vText.vt = VT_BSTR;
vText.bstrVal = _bstr_t("This is text");
hr = com->Parameters->Append(com->CreateParameter(_bstr_t("id"),ADODB::adInteger,ADODB::adParamInput,4,intNum));
hr = com->Parameters->Append(com->CreateParameter(_bstr_t("desc"),ADODB::adChar,ADODB::adParamInput,15,vText));
try
{
rec = com->Execute(strSQL, NULL, ADODB::adCmdStoredProc);
}
catch(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
printf("Error\n");
printf("\tCode = %08lx\n", e.Error());
printf("\tCode meaning = %s\n", e.ErrorMessage());
printf("\tSource = %s\n", (LPCSTR) bstrSource);
printf("\tDescription = %s\n", (LPCSTR) bstrDescription);
}
rec->Close( );
rec = NULL;
printf("Closed an removed the "
"Recordset object from memory.\n");
con->Close( );
con = NULL;
printf("Closed and removed the "
"Connection object from memory.\n");
}
|
|
|
|
|
Hi,
Few observations:
- your command type shouldn't be adCmdStoredProc since you're executing a normal DML statement. Use adCmdText instead.
- the SQL statement for insert should contain the VALUES section and the parameters to use, like:
_bstr_t strSQL("INSERT INTO mytable(id,desc) VALUES (?, ?)");
- the execute contains the SQL statement as a parameter. I'm not sure if there's such overload, normally the first parameter is the number of records affected, see: http://msdn.microsoft.com/en-us/library/ms681559(VS.85).aspx[^]
|
|
|
|
|
Mika,
Thank you for your response. After making the changes you suggested I get the following error. Instead of the "Records Affected" parameter, I have input "NULL". As a result, I am getting this error:
Connection object created.
Connection has been opened.
Error
Code = 80040e14
Code meaning = I
Source = Microsoft JET Database Engine
Description = Expected query name after EXECUTE.
|
|
|
|
|
Hi,
Could be some kind of syntax issue in the SQL statement itself. Also if I rememeber correctly the parameter usage in the sql statement may be provider specific so if the SQL statement is otherwise fine could it be because of the question mark. You could try literals as a test n order to see if that's the case.
Also perhaps the following link would help you: http://msdn.microsoft.com/en-us/library/ms677554(v=VS.85).aspx[^]
|
|
|
|
|
Hi Guys!
I am trying to retrieve middle records. The below query is working perfectly.
The problem is my table is too huge (more then 10 lak reocrd) it is taking more time. Is there any other solution?
[This is sample query]
select *
from (select t.*, rownum rn
from (SELECT *
FROM (select * from Productlist)) t
Where rownum <= 10000)
Where rn > 9990
Regards,
Nanda
|
|
|
|
|
Assuming you are using SQL Server, have some Google Foo[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hey Thanks,
Thanks for your valuable reply. I am using Oracle.
The rownum is dynamical assign to each row. so SQL server method is not working.
and I tried view it is working but when order by used the result is coming wrong.
Thanks and regards,
Nanda
|
|
|
|
|
Nanda_MR wrote: I am using Oracle
That would have been useful info, also what is a lak , presumably lots.
So you know how to get the paged set, you real question is how to optimise the query (using rownum) or if there is a better method to use in orable.
And I'm afraid there I cannot help you.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: what is a lak, presumably lots
Indians have a different style of counting big numbers. A lak is one hundred thousand (Indian style: 1,00,000), a crore is ten million (Indian style: 1,00,00,000).
But that's still easy. Stay a few days in India to get confused with more puzzling Indian style information....
|
|
|
|
|
Hi RAH,
I am trying execute my query but it is taking much time(4 to 10 min) to avoid that problem and searching efficient query or solution.
The your last post provide some ideas. it reduce execution time.
Regards,
Nanda
|
|
|
|
|
Mycroft Holmes wrote: also what is a lak
Google would happily have told you ...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I naturally did the google thing, the response was nowhere as succinct as the answer I got here
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Unfortunately conciseness isn't Google's primary strength.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Try...
select * from (
select top 10000 *, row_number() over (order by rownum) as rn
from productlist
) t
where rn between 9990 and 10000
modified on Monday, February 21, 2011 1:26 AM
|
|
|
|
|
Hi
Thanks for Query. It is reduce execution time. but when I try to access above 500000 (Top 500000) records then its taking 2 to 3 min exeuting any other solution.
For if 900000 it is taking 4 to 5 min.
Regards,
Nanda
|
|
|
|
|
SELECT *
FROM (
SELECT *
FROM Productlist pl
ORDER BY somefield
)
WHERE ROWNUM BETWEEN 9991 AND 10000 Note that you can never trust the DB to give you the records in the same order every time, so you need the order by clause.
The field you're ordering by should be indexed if you want to get any speed to your query
|
|
|
|
|
Thanks.
Problem is the table is too big it contains 10 lak to 90 lak data. while access perticular data (ex: 1500000 to 1501000) then it is taking so much time.
The Inner Query execute all records (90 lak) and the outer query filter 9991 to 10000. This is my problem.
Regards,
Nanda
|
|
|
|
|
That's why you need a index on the column you order by, it's already sorted. The optimizer will take care of the inner query.
Do you have an index on the column you're sorting by?
|
|
|
|
|
Hi,
If you do have an ascending surrogate key, one efficient way would be to use that. For example if you have a field called Id and the values are coming from ordered sequence your query could be something like:
select *
from ProductList a,
(select b.Id,
count(*) over (order by b.Id) as runcount
from productlist b
where b.Id > :lastFetchedId) subq
where a.Id = subq.Id
and subq.runcount <= 10
|
|
|
|
|
Hi Mika,
I done similarly in View. Add a new column unique ID and I am adding rownum. In this case I am executing query without any delay.
But one problem is there. In case if order by condition added the output of query is coming wrong(Bug) or a block of rows is order.
Regards,
Nanda
|
|
|
|
|
Hi,
Nanda_MR wrote: I am adding rownum
Just to check: Did you notice that I didn't use rownum at all because it's unreliable in this context (for many different reasons). The example I created shouldn't encounter any of the problems rownum has since the example is based on a running total count on an unique and ascending field.
|
|
|
|
|
Dear All
I have a form "report_test", and a single button "rptstart", when i click that button, i wrote a code, to start a report in printing preview with some viewing some records.
When i click print (printer icon) on the left top corner, the printer prints the form "report_test" with the button but not the actual report am viewing any body can can guide how to avoid this and print the report itself ???
regards,
0 will always beats the 1.
|
|
|
|