Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Friday, February 24, 2012

How i should show toolbar

Hi group,
First time i am using reportservice.render method to render the report in my
aspx page. Here is the code snippet
result = rs.Render(report,"HTML4.0",null,null,paramValue,credentials,null,out
encoding,out mimetype,out paramvalues,out warning,out streamidsh.SessionId = rs.SessionHeaderValue.SessionId;
Response.BinaryWrite(result);
by doing so i am getting all the pages on the same aspx page and no tool
baar is shown. I also tried by passing toolbar = true in device info string
but no result.
So what i should do to show the toolbar .
Thanks
SandeepHi group,
i find this in msdn
If you render a report to HTML using the Render method, you cannot use the
report viewer toolbar as you can with a report that is rendered using URL
access. However, the Toolbar device information setting still affects the
appearance of the report. If you set Toolbar to a value of true, the report
server only renders the first page of the HTML report. If you set the value
to false, the report server renders all pages into a single Web page, using
<HR> tags as page delimiters.
Is there any work around.
Please help me out
Sandeep Garg
"Sandeep" <sandeep.garg@.approva.net> wrote in message
news:%23BBQR999EHA.3988@.TK2MSFTNGP11.phx.gbl...
> Hi group,
> First time i am using reportservice.render method to render the report in
> my aspx page. Here is the code snippet
> result => rs.Render(report,"HTML4.0",null,null,paramValue,credentials,null,out
> encoding,out mimetype,out paramvalues,out warning,out streamidsh.SessionId
> = rs.SessionHeaderValue.SessionId;
> Response.BinaryWrite(result);
> by doing so i am getting all the pages on the same aspx page and no tool
> baar is shown. I also tried by passing toolbar = true in device info
> string but no result.
> So what i should do to show the toolbar .
> Thanks
> Sandeep
>|||The toolbar is only available via URL access. If you are getting a rendered
report using the webservice, you will have to implement your own toolbar.
"Sandeep" <sandeep.garg@.approva.net> wrote in message
news:uTbKJl%239EHA.3120@.TK2MSFTNGP12.phx.gbl...
> Hi group,
> i find this in msdn
> If you render a report to HTML using the Render method, you cannot use the
> report viewer toolbar as you can with a report that is rendered using URL
> access. However, the Toolbar device information setting still affects the
> appearance of the report. If you set Toolbar to a value of true, the
> report server only renders the first page of the HTML report. If you set
> the value to false, the report server renders all pages into a single Web
> page, using <HR> tags as page delimiters.
> Is there any work around.
> Please help me out
> Sandeep Garg
> "Sandeep" <sandeep.garg@.approva.net> wrote in message
> news:%23BBQR999EHA.3988@.TK2MSFTNGP11.phx.gbl...
>> Hi group,
>> First time i am using reportservice.render method to render the report in
>> my aspx page. Here is the code snippet
>> result =>> rs.Render(report,"HTML4.0",null,null,paramValue,credentials,null,out
>> encoding,out mimetype,out paramvalues,out warning,out
>> streamidsh.SessionId = rs.SessionHeaderValue.SessionId;
>> Response.BinaryWrite(result);
>> by doing so i am getting all the pages on the same aspx page and no tool
>> baar is shown. I also tried by passing toolbar = true in device info
>> string but no result.
>> So what i should do to show the toolbar .
>> Thanks
>> Sandeep
>>
>|||Thaks for the suggestion.
Can u give me some clue how to implement my own toolbar. From where i got
the total page count and all the other required stuff.
Sandeep
"FNDS" <absolutelynospam@.nodomain_.com> wrote in message
news:exk34%23%239EHA.3616@.TK2MSFTNGP11.phx.gbl...
> The toolbar is only available via URL access. If you are getting a
> rendered report using the webservice, you will have to implement your own
> toolbar.
> "Sandeep" <sandeep.garg@.approva.net> wrote in message
> news:uTbKJl%239EHA.3120@.TK2MSFTNGP12.phx.gbl...
>> Hi group,
>> i find this in msdn
>> If you render a report to HTML using the Render method, you cannot use
>> the report viewer toolbar as you can with a report that is rendered using
>> URL access. However, the Toolbar device information setting still affects
>> the appearance of the report. If you set Toolbar to a value of true, the
>> report server only renders the first page of the HTML report. If you set
>> the value to false, the report server renders all pages into a single Web
>> page, using <HR> tags as page delimiters.
>> Is there any work around.
>> Please help me out
>> Sandeep Garg
>> "Sandeep" <sandeep.garg@.approva.net> wrote in message
>> news:%23BBQR999EHA.3988@.TK2MSFTNGP11.phx.gbl...
>> Hi group,
>> First time i am using reportservice.render method to render the report
>> in my aspx page. Here is the code snippet
>> result =>> rs.Render(report,"HTML4.0",null,null,paramValue,credentials,null,out
>> encoding,out mimetype,out paramvalues,out warning,out
>> streamidsh.SessionId = rs.SessionHeaderValue.SessionId;
>> Response.BinaryWrite(result);
>> by doing so i am getting all the pages on the same aspx page and no tool
>> baar is shown. I also tried by passing toolbar = true in device info
>> string but no result.
>> So what i should do to show the toolbar .
>> Thanks
>> Sandeep
>>
>>
>|||Hmm. I haven't tackled creating my own toolbar to show a rendered report.
If someone has and is willing to share, please post a sample or URL...
Thx
"Sandeep" <sandeep.garg@.approva.net> wrote in message
news:%23gB0X$F%23EHA.2112@.TK2MSFTNGP10.phx.gbl...
> Thaks for the suggestion.
> Can u give me some clue how to implement my own toolbar. From where i got
> the total page count and all the other required stuff.
> Sandeep
> "FNDS" <absolutelynospam@.nodomain_.com> wrote in message
> news:exk34%23%239EHA.3616@.TK2MSFTNGP11.phx.gbl...
>> The toolbar is only available via URL access. If you are getting a
>> rendered report using the webservice, you will have to implement your own
>> toolbar.
>> "Sandeep" <sandeep.garg@.approva.net> wrote in message
>> news:uTbKJl%239EHA.3120@.TK2MSFTNGP12.phx.gbl...
>> Hi group,
>> i find this in msdn
>> If you render a report to HTML using the Render method, you cannot use
>> the report viewer toolbar as you can with a report that is rendered
>> using URL access. However, the Toolbar device information setting still
>> affects the appearance of the report. If you set Toolbar to a value of
>> true, the report server only renders the first page of the HTML report.
>> If you set the value to false, the report server renders all pages into
>> a single Web page, using <HR> tags as page delimiters.
>> Is there any work around.
>> Please help me out
>> Sandeep Garg
>> "Sandeep" <sandeep.garg@.approva.net> wrote in message
>> news:%23BBQR999EHA.3988@.TK2MSFTNGP11.phx.gbl...
>> Hi group,
>> First time i am using reportservice.render method to render the report
>> in my aspx page. Here is the code snippet
>> result =>> rs.Render(report,"HTML4.0",null,null,paramValue,credentials,null,out
>> encoding,out mimetype,out paramvalues,out warning,out
>> streamidsh.SessionId = rs.SessionHeaderValue.SessionId;
>> Response.BinaryWrite(result);
>> by doing so i am getting all the pages on the same aspx page and no
>> tool baar is shown. I also tried by passing toolbar = true in device
>> info string but no result.
>> So what i should do to show the toolbar .
>> Thanks
>> Sandeep
>>
>>
>>
>

How I can make trigger to Add Row 4 to my data base?

Hi

I need help about this problem

I have a data grid view like this:

Index

Code(releted to other table)

Name

Price +

Price _

1

1

BMW X5

1000000 $

2

1

BMW X3

500000 $

3

1

BMW Z3

250000 $

4

1

SUM

1750000 $

Row 4 must add by code automatically.
How? I must Use trigger or . . .?

my user may want to edit the data (some row OR price) I have a Problem.

How I can make a Code for Make SUM add row 4 and Delete this row when it loaded to edit? (Select and delete)

Or I can do some thing better than delete the row and write it again?

This doesn't seem like a SQL Server problem. If you do not want to persist the results in the backend you should do it in the client-side and add the extra row to the DataGrid from code. You should post this question in the Visual Studio or .NET Framework newsgroups.

How I can make it shorter...

Hi all, I'm quite new in this field, so I need someone help, can I? emm, how I can make this Trigger code shorter, is there any other way how I can do this?

Create Trigger Enrolment
AFTER INSERT OF SubjectName ON SUBJECT
For Each Row
Declare Stud Student%RowTYPE;
Begin
SELECT *
INTO Stud
FROM Student
WHERE stdno= :New.stdno;
IF SubjectName = "DAtabase 1" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "DAtabase 2" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Ecommerce" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Accounting 1" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Book Keeping" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Physic 1" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Engineering Math" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Java Programing" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "C++ Programing" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Advanced C++" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Management Information System" THEN
SET balance = balance - (:New.crtunits *100)
ELSE

IF SubjectName = "Database 3" THEN
SET balance = balance - (:New.crtunits *100)
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
END;Use elsif to shorten them up -

EX:

If 1 = 1 then
do this

elsif a=b then
do this

elsif a<> b then
do this

end if;

Note you only need one end if, and there is no 'E' in elsif|||I've receive this msg...
__________________________________________________ _
AFTER INSERT OF SubjectName ON SUBJECT
____________*
ERROR at line 2:
ORA-04073: column list not valid for this trigger type
__________________________________________________ _|||Only UPDATE trigger can contain "OF" clause.

And, if it is Oracle SQL, it lacks in UPDATE table statement.

Your trigger (which will compile) could be something like this:

CREATE TRIGGER enrolment
AFTER UPDATE OF subjectname
ON subject
FOR EACH ROW
DECLARE
stud student%ROWTYPE;
BEGIN
SELECT *
INTO stud
FROM student
WHERE stdno = :NEW.stdno;

IF subjectname = "DAtabase 1"
THEN
UPDATE subject
SET balance = balance - (:NEW.crtunits * 100);
ELSIF subjectname = "DAtabase 2"
THEN
UPDATE subject
SET balance = balance - (:NEW.crtunits * 100);
ELSIF subjectname = "Ecommerce"
THEN
UPDATE subject
SET balance = balance - (:NEW.crtunits * 100);
/* etc. etc. */
ELSIF subjectname = "Database 3"
THEN
UPDATE subject
SET balance = balance - (:NEW.crtunits * 100);
END IF;
END;

Sunday, February 19, 2012

How have strings within a string variable?

This works fine:

SELECT *
FROM MyTable
WHERE Code IN ('X', 'Y', 'Z')


But I want those values in a variable. If I do the below, it doesn't work because the X, Y, and Z aren't their own string:

DECLARE @.MyString varchar(50)
SET @.MyString = 'X, Y, Z'

SELECT *
FROM MyTable
WHERE Code IN (@.MyString)

Any way I can do what I'm trying to do?

Thanks for any help,

Ron

You couldn't use variables with IN statement. See this quote:

test_expression [ NOT ] IN ( subquery | expression [ ,...n ] )
expression[ ,... n ]

Is a list of expressions to test for a match. All expressions must be of the same type as test_expression.

Try to use dynamic SQL:

DECLARE @.MyString varchar(50)

SET @.MyString = '''X'', ''Y'', ''Z''' --You also need use quotes for each case

DECLARE @.MyQuery varchar(200)

SET @.MyQuery = '

SELECT *

FROM #MyTable

WHERE Code IN ('+@.MyString+')'

EXECUTE (@.MyQuery)

|||

Another method of breaking your strings into pieces is to use Jens Suessmeyer's SPLIT function. The advantage of this method is that it avoids potential SQL injection problems. An example of the split function can be found here:

http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=419984&SiteID=17

Here are a couple of other examples of how the split function might be applied:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1314989&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1337001&SiteID=1

Still another way to do this would be to store your list as a blocked list of strings like in this post:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1418032&SiteID=1

|||

An alternative approach might be to do it like this:

declare @.aList table (n int identity)
insert into @.aList default values
insert into @.aList default values
insert into @.aList default values

declare @.myTable table
( rid int,
target varchar(2)
)
insert into @.myTable
select 1, 'A' union all
select 2, 'B' union all
select 3, 'X' union all
select 4, 'Z'

declare @.myString varchar(20)
set @.myString = 'X Y Z '

select a.*
from @.myTable a
inner join @.aList b
on target = rtrim(substring(@.myString, 2*n-1, 2))

-- rid target
-- --
-- 3 X
-- 4 Z

How get the new recorde ID after formview insert

I have formview and want to get uniq id from SQL Server 2005 after it inserted.

I think i should put some code in the event of oniteminserted, anybody have sample code

Thanks

Hu

http://www.davidj.org/stories/162/ASP.NET_Return_Identity_After_SQL_Insert.html