Friday, March 30, 2012
OPENQUERY from ASP.NET Page Problem?
displaying the results through Index Server linked to SQL Server when
it is matched. For which I'm using Openquery in the stored procedure
which works fine in Query Analyzer of the SQL Server but doesn't work (
shows none of the results) when i call it from the ASP.NET Page. I am
not able to figure out Where and What is the problem?
The Stored Proc which is i'm using is shown below
Any help will be greatly appreciated. Thanks for your time and help in
Advance
CREATE PROCEDURE SelectIndexServerCVpaths
(
@.searchstring varchar(100)
)
AS
SET @.searchstring = REPLACE( @.searchstring, '''', ''' )
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE
TABLE_NAME = 'FileSearchResults')
DROP VIEW FileSearchResults
EXEC ('CREATE VIEW FileSearchResults AS SELECT * FROM
OPENQUERY(FileSystem,''SELECT Directory, FileName,
DocAuthor, Size, Create, Write, Path FROM
SCOPE('''' "c:\inetpub\wwwroot\sap-resources\Uploads" '''') WHERE
FREETEXT('' + @.searchstring + '')'')')
SELECT * FROM CVdetails C, FileSearchResults F WHERE C.CV_Path =
F.PATH AND C.DefaultID=1
GO
which works with followin stat in Query Analyzer
Exec SelectIndexServerCVpaths
@.searchstring = 'The Search text'
but doesn't work when i connect it to a Datagrid in my ASP.NET Page
objcmd = new SqlCommand("SelectIndexServerCVpaths", objConn);
objcmd.CommandType = CommandType.StoredProcedure;
objcmd.Parameters.Add("@.searchstring",strsearchstrings);
objConn.Open();
objRdr = objcmd.ExecuteReader();
dgcvs.DataSource=objRdr;
dgcvs.DataBind();
objRdr.Close();
objConn.Close();Did you try it with impersonation on?
http://support.microsoft.com/kb/323293/en-us
Also why don't you just query indexing services directly through ixsso, or
msidxs?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"savvy" <johngera@.gmail.com> wrote in message
news:1137934280.281102.175800@.o13g2000cwo.googlegroups.com...
> I'm performing a particular word Search in MS Word, Text, PDF docs and
> displaying the results through Index Server linked to SQL Server when
> it is matched. For which I'm using Openquery in the stored procedure
> which works fine in Query Analyzer of the SQL Server but doesn't work (
> shows none of the results) when i call it from the ASP.NET Page. I am
> not able to figure out Where and What is the problem?
> The Stored Proc which is i'm using is shown below
> Any help will be greatly appreciated. Thanks for your time and help in
> Advance
>
> CREATE PROCEDURE SelectIndexServerCVpaths
> (
> @.searchstring varchar(100)
> )
> AS
> SET @.searchstring = REPLACE( @.searchstring, '''', ''' )
> IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE
> TABLE_NAME = 'FileSearchResults')
> DROP VIEW FileSearchResults
> EXEC ('CREATE VIEW FileSearchResults AS SELECT * FROM
> OPENQUERY(FileSystem,''SELECT Directory, FileName,
> DocAuthor, Size, Create, Write, Path FROM
> SCOPE('''' "c:\inetpub\wwwroot\sap-resources\Uploads" '''') WHERE
> FREETEXT('' + @.searchstring + '')'')')
> SELECT * FROM CVdetails C, FileSearchResults F WHERE C.CV_Path =
> F.PATH AND C.DefaultID=1
> GO
> which works with followin stat in Query Analyzer
> Exec SelectIndexServerCVpaths
> @.searchstring = 'The Search text'
> but doesn't work when i connect it to a Datagrid in my ASP.NET Page
> objcmd = new SqlCommand("SelectIndexServerCVpaths", objConn);
> objcmd.CommandType = CommandType.StoredProcedure;
> objcmd.Parameters.Add("@.searchstring",strsearchstrings);
> objConn.Open();
> objRdr = objcmd.ExecuteReader();
> dgcvs.DataSource=objRdr;
> dgcvs.DataBind();
> objRdr.Close();
> objConn.Close();
>|||Thanks for your time and help
I'll try out the above|||Thanks for your time Hillary
I tried with impersonation with both true and false as well
it didn't make any difference
At present i'm getting some results which are static not changing with
the search word
I can't query just Indexing Services as you can see in my stored
procedure i'm linking my SQL Server Database table with the Index
Server Results
and displaying the results
Is there any problem in my Connection String which is shown below
SqlConnection objConn = new
SqlConnection(" Server=MISC\\MISC;Database=sapresources;
User
ID=sap;Password=sapres;");
that's it i'm not using any provider name, catalog name nothing of that
sort, Is that right ?sql
OPENQUERY from ASP.NET Page Problem?
I'm performing a particular word Search in MS Word, Text, PDF docs and displaying the results through Index Server linked to SQL Server when
it is matched. For which I'm using Openquery in the stored procedure
which works fine in Query Analyzer of the SQL Server but doesn't work ( displays none of the results) when i call it from the ASP.NET Page. I am
not able to figure out Where and What is the problem?
The Stored Proc which is i'm using is shown below
Any help will be greatly appreciated. Thanks for your time and help in
Advance
CREATE PROCEDURE SelectIndexServerCVpaths
(
@.searchstring varchar(100)
)
AS
SET @.searchstring = REPLACE( @.searchstring, '''', ''' )
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE
TABLE_NAME = 'FileSearchResults')
DROP VIEW FileSearchResults
EXEC ('CREATE VIEW FileSearchResults AS SELECT * FROM
OPENQUERY(FileSystem,''SELECT Directory, FileName,
DocAuthor, Size, Create, Write, Path FROM
SCOPE('''' "c:\inetpub\wwwroot\sap-resources\Uploads" '''') WHERE
FREETEXT('' + @.searchstring + '')'')')
SELECT * FROM CVdetails C, FileSearchResults F WHERE C.CV_Path =
F.PATH AND C.DefaultID=1
GO
which works with followin stat in Query Analyzer
Exec SelectIndexServerCVpaths
@.searchstring = 'The Search text'
but doesn't work when i connect it to a Datagrid in my ASP.NET Page
objcmd = new SqlCommand("SelectIndexServerCVpaths", objConn);
objcmd.CommandType = CommandType.StoredProcedure;
objcmd.Parameters.Add("@.searchstring",strsearchstrings);
objConn.Open();
objRdr = objcmd.ExecuteReader();
dgcvs.DataSource=objRdr;
dgcvs.DataBind();
objRdr.Close();
objConn.Close();
Has No-one got any idea the above Question ? Is the above problem that complicated ?
|||
savvy wrote:
Has No-one got any idea the above Question ? Is the above problem that complicated ?
You question is not complicated but it is not valid implementation because SQL Server can perform what you want back in SQL Server 7.0 in 1999. Now if you can interested in valid solution post again and I can give you some links.
The reason Information Schema Views and Openquery are ANSI SQL for inter RDBMS( relational database management system) communication not for SQL Server and IIS index server. Hope this helps.
|||Thanks for your help. So, Is my analogy wrong ? I have implemented this because i need to link SQL server and Index Server so that i can grab the data in the SQL Server and i had no idea of other ways of achieving this .
If you got any information to get around this problem that will be really great as I've been trying to solve this problem since a week.
Thanks in Advance
|||Try these links the first deals with using both Image and text columns to get what you want and the second is SQL Server Full Text Blog, he was with the Microsoft SQL Server Full Text team. If you cannot find your solution in his blog he will answer your post at SQL Server Central forums. Hope this helps.
http://forums.asp.net/949146/ShowPost.aspx
http://spaces.msn.com/members/jtkane/?partqs=cat%3DSQL+Server+2000+Full-Text+Search&_c11_blogpart_blogpart=blogview&_c=blogpart
|||Thanks for your help
Can you tel me is there any way to read the Word or PDF documents and store the text it in a database field (ntext) . Is this is possible?
Thanks in advance
|||Savvy,
I think you have skipped design and is coding so you are complicating simple problems. The create table statement below comes from Microsoft new sample database AdventureWorks, you can store the files as Word or PDF on image columns but also use text to store the same files so you can use the Microsoft Full Text Index and do the key word search you want. What design do for you is look for alternative implementations which takes the complications out of the problem. Run a search for the AdventureWorks database on Microsoft site install it run tests and take the tables you need for your application. Hope this helps.
CREATE TABLE [ProductPhoto] (
[ProductPhotoID] [int] IDENTITY (1, 1) NOT NULL ,
[ThumbNailPhoto] [image] NULL ,
[ThumbnailPhotoFileName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LargePhoto] [image] NULL ,
[LargePhotoFileName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ModifiedDate] [datetime] NOT NULL CONSTRAINT [DF_ProductPhoto_ModifiedDate] DEFAULT (getdate()),
CONSTRAINT [PK_ProductPhoto_ProductPhotoID] PRIMARY KEY CLUSTERED
(
[ProductPhotoID]
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Thanks Caddre for your help. It was a really long journey after i got your reply, when i got shifted totally from linked servers to FULL TEXT INDEXING in MICROSOFT SEARCH SERVICE. I had many problems to solve such as my FULL TEXT INDEXING was grayed out so i need to install DEVELOPER Edition on my System coz my O/S is Win XP Prof. I read many of your Posts regarding this topic. I personally thank u alot for your help which u have rendered in this field.
Thank you very much
|||What error are you getting?|||Savvy,
Thanks for the complement and I am glad I could help.
Monday, March 26, 2012
Opening Mulitple Recordsets
opens and closes 14 recordsets from stored procedures to obtain various
product information before closing the connection.
Is it common practice to do something like this? Or is opening 14
recordsets going to become a real problem when the page goes live and starts
getting high web traffic?
Thank you in advance for any information you might provide.
DaveHi
There is not really enough detail to know if you will have problems with
this although 14 seems quite a few it may not necessarily cause any problems
if the number of records being retrieved is not excessive. You should
simulate different levels of usage on your system before it goes live to get
some idea of the response.
If you are making muliple calls to different stored procedures, you may wish
to use a controlling procedure that returns multiple result sets see:
http://www.aspfaq.com/show.asp?id=2319
John
"Toonman" <toonman@.NOSPAMtoonman.com> wrote in message
news:4fZLb.10540$uF6.3301521@.news1.news.adelphia.n et...
> I have a single .asp page that opens a connection and then sequentially
> opens and closes 14 recordsets from stored procedures to obtain various
> product information before closing the connection.
> Is it common practice to do something like this? Or is opening 14
> recordsets going to become a real problem when the page goes live and
starts
> getting high web traffic?
> Thank you in advance for any information you might provide.
> Dave|||John,
Your information was extremely helpful... thank you again.
Dave
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:btpp2d$8ja$1@.sparta.btinternet.com...
> Hi
> There is not really enough detail to know if you will have problems with
> this although 14 seems quite a few it may not necessarily cause any
problems
> if the number of records being retrieved is not excessive. You should
> simulate different levels of usage on your system before it goes live to
get
> some idea of the response.
> If you are making muliple calls to different stored procedures, you may
wish
> to use a controlling procedure that returns multiple result sets see:
> http://www.aspfaq.com/show.asp?id=2319
> John
> "Toonman" <toonman@.NOSPAMtoonman.com> wrote in message
> news:4fZLb.10540$uF6.3301521@.news1.news.adelphia.n et...
> > I have a single .asp page that opens a connection and then sequentially
> > opens and closes 14 recordsets from stored procedures to obtain various
> > product information before closing the connection.
> > Is it common practice to do something like this? Or is opening 14
> > recordsets going to become a real problem when the page goes live and
> starts
> > getting high web traffic?
> > Thank you in advance for any information you might provide.
> > Dave
Opening hyperlink Url in new window
Hello,
I have areport with a text box. The text box is hyperlinked to another report url. The report opens in a new page when previewed with RS 2005 but when deployed the report opens in teh same page from where it is referenced.
How can I set a property with the texbox to always open in a new page the hyperlinked report.
Thanks in advance
'Kiran.
I'm not going to be any help... I have the same question. The report itself uses XML to generate not html so it is not a matter of setting target = '_blank'. That's about as far as I've gotten. Any help with this would be appreciated by me as well.
Thanks
Friday, March 23, 2012
Open URL in new page from a frame
- I need to open a report in a new page, from a report contained in a
iFrame of a aspx page
I tried a javascript window.open command in the "jump to URL" property.
But:
- If i run the report in Explorer, i click and the report is correctly
open in a new page
- If i run the report in the iFrame of the aspx page, i click but the
report is wrongly open in the same page
I tried a lot but i can't see the right way. I really need help.
P.S. Sorry for my bad English LanguageHere is an example of a Jump to URL link I use. This causes Excel to come up
with the data in a separate window:
="javascript:void(window.open('" & Globals!ReportServerUrl &
"?/SomeFolder/SomeReport&ParamName=" & Parameters!ParamName.Value &
"&rs:Format=CSV&rc:Encoding=ASCII','_blank'))"
If you don't want to have it appear in a new window then do this in jump to
URL:
=Globals!ReportServerUrl & "?/SomeFolder/SomeReport&ParamName=" &
Parameters!ParamName.Value & "&rs:Format=CSV&rc:Encoding=ASCII"
This capability was introduced with RS2000 SP1
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Boa" <mugnaboa@.gmail.com> wrote in message
news:1156498995.499936.169520@.h48g2000cwc.googlegroups.com...
> Hi, i have a problem:
> - I need to open a report in a new page, from a report contained in a
> iFrame of a aspx page
> I tried a javascript window.open command in the "jump to URL" property.
> But:
> - If i run the report in Explorer, i click and the report is correctly
> open in a new page
> - If i run the report in the iFrame of the aspx page, i click but the
> report is wrongly open in the same page
> I tried a lot but i can't see the right way. I really need help.
> P.S. Sorry for my bad English Language
>|||I tried a lot of solutions, serious end crazy solutions, but i'm always
in the same situation: i can't open a link in a new page if ny report
is in a iFrame.
[URL=http://img177.imageshack.us/my.php?image=tabellatentativinf4.jpg][IMG]http://img177.imageshack.us/img177/4769/tabellatentativinf4.th.jpg[/IMG][/URL]
In the image u can see my attempts, in the Explorer Column i explain
the result if i run the report directly in the explorer's page, in the
iFrame Column i explain the result if i run the report in my
application. I need to find a "new page" in the iFrame column.
Any idea?|||Bruce ... i need your help!|||Sorry, I don't know why it isn't working. I haven't done what you are trying
to do.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Boa" <mugnaboa@.gmail.com> wrote in message
news:1157640447.600521.206140@.b28g2000cwb.googlegroups.com...
> Bruce ... i need your help!
>
Tuesday, March 20, 2012
Open or Download a file in Sql Reports Resources using Report Service API
Using the reporting service web service to get the file path for a reports and the report viewer control on a Web page, it is possible to view reports. This works fine. I built a tree view that shows the reports. I also show resource files ( like .xls or .doc files ) that a user may have uploaded to the report directory. I show these filenames in the treeview as well as actual sql reports. If the user clicks on a report name, I set the path in the report viewer control and the report is rendered.
Now I would also like the user to be able to download or open any xls or doc file that may also be in the report directory from this web application.
Is this possible?
Normally in the Report Manager it uses Resources.aspx to download or open the file.
Is there any way to access these files programatically?
thanks
-Barb
Okay I found the answer, it is using the Report Web ServicegetResourceContents()
-Barb
Friday, March 9, 2012
open a web page through SQL SQL job
Hi all,
now, i create a job to open a page on timely basis. The job's Vb script is like that:
Dim WshShell
Set WshShell =CreateObject("WScript.Shell")
WshShell.Run ("http://www.google.com")
Set WsShell = Nothing
when i run that job, i got that error:
The job succeeded. The Job was invoked by User host\username. The last step to run was step 1 (Step 1).
how can i solve it? i still don't know whether that script will open a webpage or not
The following script opens a webpage in a VBS Script:
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "iexplore.exe http://www.google.com"
Set WsShell = Nothing
I think that one will work in web page. But, now i m trying in SQL job. I have tried with that code. But, nothing happen.
regards,
Open a url from report in new window
Hello,
I have areport with a text box. The text box is hyperlinked to another report url. The report opens in a new page when previewed with RS 2005 but when deployed the report opens in teh same page from where it is referenced.
How can I set a property with the texbox to always open in a new page the hyperlinked report.
Thanks in advance
'Kiran.
You can set the &rc:LinkTarget= URL parameter to use &rc:LinkTarget="_blank"
http://msdn2.microsoft.com/en-us/library/aa179583(SQL.80).aspx
Not sure if you can set the property directly from the report itself.
cheers,
Andrew
Open a blank or new record set code needed.
Im not sure if this is the best forum for this question as you say the page gets its data successfully from an MS SQL 2005 Database server.
Sorry to not be able to assist more.
|||
If you connect a table through a linked table to SQL Server, you will have to specify a primary key on the Access side, otherwise Access might not know how to update / insert new records.
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
Thank you for your input.
I don’t want to sound confusing although I am confused! Here goes. I built the Access database with Access 2007, connecting to a 2005 SQL server. The database tables all have primary keys. The forms all function fine and I used the code in them “d0cmd on open goto newrecord” and the forms open ready for a new record concealing existing data from the users.
I then used access 2003, to create data access pages and publish them to our web site. (nice trick ha?) So far this works fine usingthe record navigator and custom built controls I can ad / edit and create new records. What I need to solve is, when I open a data access page over the internet the first record is displayed. I need the page to open and be ready to accept a new record showing all blank fields and not existing records.
The data assess page requires different coding to accomplish this than the forms and this is where I am getting lost?
|||I found the solution this was easy, open the dataaccess page in design view in access, select edit / page and set the can edit properties to false, the page opens to a blank record and will not reveal other records, just what i wanted.Open a blank or new record set code needed.
Im not sure if this is the best forum for this question as you say the page gets its data successfully from an MS SQL 2005 Database server.
Sorry to not be able to assist more.
|||
If you connect a table through a linked table to SQL Server, you will have to specify a primary key on the Access side, otherwise Access might not know how to update / insert new records.
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
Thank you for your input.
I don’t want to sound confusing although I am confused! Here goes. I built the Access database with Access 2007, connecting to a 2005 SQL server. The database tables all have primary keys. The forms all function fine and I used the code in them “d0cmd on open goto newrecord” and the forms open ready for a new record concealing existing data from the users.
I then used access 2003, to create data access pages and publish them to our web site. (nice trick ha?) So far this works fine usingthe record navigator and custom built controls I can ad / edit and create new records. What I need to solve is, when I open a data access page over the internet the first record is displayed. I need the page to open and be ready to accept a new record showing all blank fields and not existing records.
The data assess page requires different coding to accomplish this than the forms and this is where I am getting lost?
|||I found the solution this was easy, open the dataaccess page in design view in access, select edit / page and set the can edit properties to false, the page opens to a blank record and will not reveal other records, just what i wanted.Open / Read / Split / Insert / Repeat
What I want to do before it goes to the next line is insert that strData in to a SQL DB.
This is my InsertCommand for my SqlDataSource1:
InsertCommand="INSERT INTO [Numbers] ([WTN], [DSL_Qualified], [DSL_Qualified_Date], [Equip_1MM], [Line_Trouble], [Sync_Rate], [Res_Bus], [Host_Remote]) VALUES (@.WTN, @.DSL_Qualified, @.DSL_Qualified_Date, @.Equip_1MM, @.Line_Trouble, @.Sync_Rate, @.Res_Bus, @.Host_Remote)"
Plus the <InsertParameters>:
<InsertParameters>
<asp:Parameter Name="WTN" Type="Int32" />
<asp:Parameter Name="DSL_Qualified" Type="String" />
<asp:Parameter Name="DSL_Qualified_Date" Type="DateTime" />
<asp:Parameter Name="Equip_1MM" Type="String" />
<asp:Parameter Name="Line_Trouble" Type="String" />
<asp:Parameter Name="Sync_Rate" Type="String" />
<asp:Parameter Name="Res_Bus" Type="String" />
<asp:Parameter Name="Host_Remote" Type="String" />
</InsertParameters
So I'm not sure exactly what to do after this:
while (file.Peek() > -1)
{
string strCSVData = file.ReadLine();
string [] strData = strCSVData.Split(',');
// somehow get strData in to the SqlDataSource1.Insert method??
}
Any help would be appreciated.
Thanks.
DataSource controls are meant to be databound to other controls. You can programmatically control them, but they can be a bit touchy if you do.
This is what you want:
(Written in vb.net, sorry)
Dim conn as new sqlconnection("{Your connect string here}") ' or pull from web.config
dim cmd as new sqlcommand("INSERT INTO [Numbers] ([WTN], [DSL_Qualified], [DSL_Qualified_Date], [Equip_1MM], [Line_Trouble], [Sync_Rate], [Res_Bus], [Host_Remote]) VALUES (@.WTN, @.DSL_Qualified, @.DSL_Qualified_Date, @.Equip_1MM, @.Line_Trouble, @.Sync_Rate, @.Res_Bus, @.Host_Remote)",conn)
cmd.parameters.add("@.WTN",int)
cmd.parameters.add("@.DSL_Qualified",varchar)
cmd.parameters.add("@.DSL_Qualified_Date",datetime)
{add rest of parameters here}
conn.open;
while (file.Peek() > -1)
{
string strCSVData = file.ReadLine();
string [] strData = strCSVData.Split(',');
// somehow get strData in to the SqlDataSource1.Insert method??
cmd.parameters("@.WTN").value=strData[0];
cmd.parameters("@.DSL_Qualified").value=strData[1];
{Set rest of parameters here}
cmd.executenonquery;
}
conn.close;
Your other choices if you really want to continue with the sqldatasource control, is to set the parameters using the default values, then call the .insert method of the datasource control. If that doesn't work, then you can make strData class scoped variable (Private member for C#?), call the .insert method, and catch the datasource_Inserting event, and set the sqlcommand parameters there via e.command.parameters.
OOpening report in new page without using url.
Sounds simple but here is what I need. I have an aspx webform that asks the user for 19 parameters that my report requires. I need to validate the form and have a button that the user can click and have the report open in a new window. Like I said the report has 19 parameters and we would like to avoid passing the parameters in the url. Here is what I’ve tried:
Using cross-page postback I can pass the parameters captured in the Getparameters webform to the viewreport webpage but it opens on the same window. I can use a regular button or a linkbutton and added “onclick” attributes to run clientside validation before submitting a form. The viewreport webpage has a reportviewer control. I just need to open the report in a new window.
Tried javascript window.open in several places (btnView “onclick”, linkbutton “onclick”, registerclientscriptblock (runs after the form is posted) all giving me the error “object null reference exception” on the report parameters.
Lastly I’m trying to use SOAP and running render method for button on_click but I keep getting the error report path not valid report path needs to be less than 260 characters and must start with slash. Here is the code that I’m using for render method:
Dim rsAsNew RSWebReference.ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
'Render Arguments
Dim resultAsByte =Nothing
Dim reportPathAsString ="/Sales/MonthlySales"
Dim formatAsString ="PDF"
Dim historyIDAsString =Nothing
Dim devInfoAsString = “<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"
'Prepare report Parameters
Dim parameters(0)As RSWebReference.ParameterValue
parameters(0) =New RSWebReference.ParameterValue
parameters(0).Name ="Date"
parameters(0).Value ="09/10/2006"
Dim credentials()As RSWebReference.DataSourceCredentials =Nothing
Dim showhidetoggleAsString =Nothing
Dim encodingAsString =""
Dim mimeTypeAsString =""
Dim warnings()As RSWebReference.Warning =Nothing
Dim reportHistoryParametersAs RSWebReference.ParameterValue() =Nothing
Dim streamIDAsString() =Nothing
rs.Render("MonthlySales","PDF", historyID, devInfo, parameters, credentials, showhidetoggle, encoding, mimeType, reportHistoryParameters, warnings, streamID)
I just want to know if what I want to accomplish is even posible because I’ve been at this for over a week, going Crazy!
I thought maybe the report needed credentials set instead of nothing, but don’t know how to do that. Using VS 2005, SQL 2005
Any help is immensely appreciated!
I've tried a bunch of different things myself and can't seem to get it. It would be nice that after you call rs.Render(), rs would have a property set to the url of what you just ran. There is a method rs.GetReportLink(ReportName as String) but it just returns the url to the report with none of the query string. My guess is you'll be writing a URL Generator and using a RegisterStartUp script to call a javascript:window.open(). Works well for me.|||
I finally figured it out. Seems that I had the incorrect webreference and was sending the wrong parameters, but here is my solution.
I added a web reference to ReportExecution2005 and used the following code:
Response.BufferOutput = True
Response.ClearContent()
Response.ClearHeaders()
Response.AddHeader("content-type", ContentType)
Response.AddHeader("Content-Length", result.Length.ToString)
Response.AddHeader("content-disposition", "attachement;filename='" & FileName & "'")
Response.BinaryWrite(result)
Response.Flush()
Response.Clear()
'End the response
Response.End()
By using content-disposition "attachement" I have the browser ask the user to open or save the report. To have this open in a new window I had to go with the form target=_blank. I did find that different MIME types yield different results. For example using "application/pdf" will open the pdf document in a the recently opened new browser window. Using "application/x-pdf" will open the pdf document in acrobat session leaving a blank page behind. I also tried exporting the report to excel, but the onlyl issue with excel is that it renders the report formated so some columns do not match the cells. I haven't figured out how to render that correctly.
Wednesday, March 7, 2012
only when i use a grid view!
hi, i have done some testing and its only when i put a grid view or any other type of data viewer on the page, and then connect it to the sql datasource that i get an error
Line 1: Incorrect syntax near ')'.
now i really cant figure out what it is, here is the code i am using
SQL data source code :
asp
:SqlDataSourceID="SQLDS_view_one_wish"runat="server"ConnectionString="<%$ ConnectionStrings:wishbank_DBCS %>"SelectCommand="SELECT [msg], [Date_Time] FROM [tbl_MSG] WHERE (([Activated] = @.Activated) AND ([msgID = @.msgID]) )ORDER BY [Date_Time] DESC"><SelectParameters><asp:ParameterDefaultValue="Y"Name="Activated"Type="String"/><asp:SessionParameterName="msgID"SessionField="sWV"Type="String"/></SelectParameters></asp:SqlDataSource>
session variable code which sends it to this page
protectedvoid GridView1_SelectedIndexChanged(object sender,EventArgs e){
GridViewRow row = GridView1.SelectedRow;Session[
"sWV"] = row.Cells[1].Text;Response.Redirect(
"www/viewwf.aspx");}
if you have an idea please let me know as im stuck!
TRY THIS:
<asp:SqlDataSource ID="SQLDS_view_one_wish" runat="server"SelectCommandType="Text" ConnectionString="<%$ ConnectionStrings:wishbank_DBCS%>"SelectCommand="SELECT [msg], [Date_Time] FROM [tbl_MSG] WHERE (([Activated] = @.Activated) AND ([msgID = @.msgID]) )ORDER BY [Date_Time] DESC"><SelectParameters><asp:Parameter DefaultValue="Y" Name="Activated" Type="String" /><asp:SessionParameter Name="msgID" SessionField="sWV" Type="String" /></SelectParameters></asp:SqlDataSource>
Only show group header once per page.
I have a main report with a subreport in it. My problem is I want to print the subreports 'report header' whenever the subreport encounters a new page. I didn't find a way to do that so I placed a group in my subreport. But I only want the 'group header' once per page even though the details of the subreport is printing several times per page. Is there a way to do this.
/HeleniusHey, here's how to make a fake pageheader for a subreport and print it on every new page...
http://support.businessobjects.com/library/kbase/articles/c2005103.asp
Only show field on last page
i would like to show some fields only on the last page on the report. How can i achieve this?
(The field is in the body area)
King regards,
Christian NiehavesYou can exactly control the report pagination if this is what you after but if the fields are at the end of the report body (below the main report region) they will show last on the report.|||Hallo,
is there any possiblity to get the current page number and the total number of pages in the body area of a report?
King regards
Christian Niehaves|||The only way I know of is to pass the page number to a code-behind variable in the page footer and read it in the report body.|||
I have only rdl file, how to pass the page number to a code-behind variable ? I think i can't to do that via xml.
|||The idea was to create a VB.NET variable in the report properties Code tab. Since PageNumber and TotalPages are available only in the page header/footer, use one of the exression-based properties of the Page Header band to set the variable and then read it from the Textbox in the body section, e.g. =Code._PageNumber (assuming that _PageNumber is the variable).|||I'm understood it, but i have the report server project generated by wizard, and seems to me that i don't have VB or C# codebehind, only rdl file with xml syntax. How i can place current page number into the body of report?
Sorry for my English.
Thank you.
|||I attempted to add expressions =ReportItems!TextboxInHeader.Value for field in the body and i've got compiling error:
Error 1 [rsReportItemReference] The Value expression for the textbox ‘textboxInBody’ refers to the report item ‘TextboxInHeader’. Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope.
|||You cannot cross-reference items in different bands. Actually, I appologize for giving a wrong page number hack. Pseudo-events like these (setting a var in one band and reading it in another) were working (but were not supported) in RS 2000. In RS 2005, the expression execution order was changed. The net effect is that when reading the variable in the body section, you won't be able to "see" the changes made by the bands. This effectively means that there is no way that I know of to pass a page number to the body section.|||Thank you.Only show field on last page
i would like to show some fields only on the last page on the report. How can i achieve this?
(The field is in the body area)
King regards,
Christian NiehavesYou can exactly control the report pagination if this is what you after but if the fields are at the end of the report body (below the main report region) they will show last on the report.|||Hallo,
is there any possiblity to get the current page number and the total number of pages in the body area of a report?
King regards
Christian Niehaves|||The only way I know of is to pass the page number to a code-behind variable in the page footer and read it in the report body.|||
I have only rdl file, how to pass the page number to a code-behind variable ? I think i can't to do that via xml.
|||The idea was to create a VB.NET variable in the report properties Code tab. Since PageNumber and TotalPages are available only in the page header/footer, use one of the exression-based properties of the Page Header band to set the variable and then read it from the Textbox in the body section, e.g. =Code._PageNumber (assuming that _PageNumber is the variable).|||I'm understood it, but i have the report server project generated by wizard, and seems to me that i don't have VB or C# codebehind, only rdl file with xml syntax. How i can place current page number into the body of report?
Sorry for my English.
Thank you.
|||I attempted to add expressions =ReportItems!TextboxInHeader.Value for field in the body and i've got compiling error:
Error 1 [rsReportItemReference] The Value expression for the textbox ‘textboxInBody’ refers to the report item ‘TextboxInHeader’. Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope.
|||You cannot cross-reference items in different bands. Actually, I appologize for giving a wrong page number hack. Pseudo-events like these (setting a var in one band and reading it in another) were working (but were not supported) in RS 2000. In RS 2005, the expression execution order was changed. The net effect is that when reading the variable in the body section, you won't be able to "see" the changes made by the bands. This effectively means that there is no way that I know of to pass a page number to the body section.|||Thank you.Saturday, February 25, 2012
Only getting one record in preview mode
I've created a new simple report and I am trying to figure out why I am only getting one page of the report when I am expecting a page per db record.
1. I have a simple query that returns 7 rows of data, 1 column 'name'. They query test good in the Data tab.
2. I have dragged and drop that column to my page on the Design tab
3. I then go to the Preview tab and I only get one page with the name on it.
What am I doing wrong - I expected one page per record from my query.
Thanks,
Patrick
Obvious question first - have you checked your group by on your report (NOT data tab)?|||Where would I find this?|||Assuming you are displaying your data in a table, then just select the table. Right click on the selected table, and check out the 'Groups' tab...