Showing posts with label text. Show all posts
Showing posts with label text. Show all posts

Thursday, March 29, 2012

Can I Insert/Update Large Text Field To Database Without Bulk Insert?

I have a web form with a text field that needs to take in as much as the user decides to type and insert it into an nvarchar(max) field in the database behind. I've tried using the new .write() method in my update statement, but it cuts off the text after a while. Is there a way to insert/update in SQL 2005 this without resorting to Bulk Insert? It bloats the transaction log and turning the logging off requires a call to sp_dboptions (or a straight-up ALTER DATABASE), which I'd like to avoid if I can.

You can't just use a plain old update statement and set the column = a parameter of the correct datatype?

|||

How do you indicate that a SqlParameter is of type nvarchar(max)? Any numeric length up to 4000 is easy, but beyond that I've come up empty.

|||

When I add a parameter to a command, I use the AddWithValue method instead of the Add method. That way I don't have to type in the datatype and the length, I just pass it text and it works.

It's possible that it will truncate on you using that method, but I've used it with ntext and long text values before

|||

cmd.Parameters.Add("@.Blobby",SqlDbType.Nvarchar)

or

cmd.Parameters.Add("@.Blobby",SqlDbType.Nvarchar,-1)

|||

cmd.Parameters.AddWithValue("@.Blobby",myTextBox.Text)

(or any other object's value instead of myTextBox)

|||

I normally don't recommend AddWithValue because it can cause some problems when it's unclear what the conversions (if any) should be. This comes into play when the result to be passed could possibly be a nvarchar or a more specific data type (integers, dates). Under certain circumstances, .NET decides to send the data to SQL Server as a nvarchar, and when it gets there, it realizes that it needs to be converted to a more specific data type, but the information needed to do the conversion correctly (because of culture formatting) isn't available on the server, or it uses the servers culture rather than the culture of the running page.

Using .Add with a specified datatype insures that the data conversion is done by .NET before sending the parameter on to SQL Server.

Thursday, March 22, 2012

Can I define the True/False text labels for a Boolean report param

SSRS 2005
Boolean report parameters are convenient to use.
However, the rendering of the "True"/"False" radio button labels is not
always appropriate. For example sometimes I would prefer the labels to be
"Enabled"/"Disbaled", "Yes"/"No", etc.
Is there anyway to define the text labels differently for each boolean
report parameter?
--
Chris, SSSIHi Chris,
As for this question, I think it is just like the "boolean parameter
represented with checkbox" thread you posted, so far the ReportViewer
control can not support such small granularity level customization.
BTW, if you do want to change the text, one way is use client-script as
I've mentioned in a former thread, but that's not quite flexible when
dealing with multiple different reports.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.sql

Tuesday, March 20, 2012

Can I change the text on the "View Report" button?

SSRS 2005
In the web form Report Viewer Control, is there a simple way to change the
text that appears on the "View Report" button?
I would like to either shorten the text or have it appear on two lines to
minimize the page width taken up by this button.
-- Chris
--
Chris, SSSIHello Chris,
As for the ReportViewer Control's "ViewButton", based on my research, it is
encapsulated as an "ViewReportButton" class which is an internal Type. I've
tried reference to this button instance from ReportViewer control's
Controls collection and change it Text, but that didn't work. I think it is
internally assigned the "View Report" text value. Actually since
Reportviewer is a well encapsulated webcontrol, there hasn't much options
for us to customize its individual settigns.
So far what I can get are the following two options if we want to provide a
custom parameterArea or button:
1. Still use the ReportViewer's built-in parameterArea and
ViewReportButton, however, we can only change the button's text by using
clent-side script(find the submit button and change its value), e.g:
==========================<script language="javascript">
function AdjustViewButton()
{
var div = document.getElementById("ReportViewer1");
elems = form1.getElementsByTagName("INPUT");
var i;
for(i=0;i<elems.length;i++)
{
if(elems[i].type == "submit" && elems[i].value == "View Report")
{
elems[i].value = "View";
}
}
}
.........................
<body onload="AdjustViewButton();" >
...............
=============================
2. Do not use the built-in parametersArea of the ReportViewer control(hide
it by setting ShowParameterPrompt=false), and provide our own UI(like label
and textbox ) to accept parameters from user, also add our own View Report
Button, and in the button's click event, we need to use custom code to add
parameters into ReportViewr.serverReport's parameters collection and render
the report.
Hope this helps some. If you have any other ideas, please feel free to let
me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hello Chris,
How are you doing on this issue, have you got any further idea or does my
last reply helps you a little? If there is any other information you
wonder, please feel free to let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Steven,
Thank you for your reply and suggestions. It is not what I wanted to hear
;-) but I understand your proposals.
It would be nice if Microsoft could provide the ability to do such simple
customization through properties, etc. in the future.
It seems that the out of the box SRSS offering gets you going very quickly,
but very soon you also run into limitations and have to write custom code. It
is of course great that such custom code solutions are possible (it is very
flexible), but it also minimizes the productivity gains to be obtained with
SRSS. Just my 2 cents. ;-)
-- Chris
Chris, SSSI
"Steven Cheng[MSFT]" wrote:
> Hello Chris,
> How are you doing on this issue, have you got any further idea or does my
> last reply helps you a little? If there is any other information you
> wonder, please feel free to let me know.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Thanks for your followup Chris,
Yes, I can understand your concern here since what you want to customize is
just a simple Text property of the Button and it will be much more
convenient if the ReportViewer control has provide such a property for
modify it directly.
Fortunately the ReportViewer control still provide some programmtic
approach here as workaround. Also, since this is the first version of the
component, the dev team may haven't considered all the possible scenarios.
So please trust me, our dev guys will surely improve it for sequential
release(also the reporting services) according to more and more community
user experience and feedback. Thus, any of your feedback and comments are
really important to us.
Please feel free to post your comments and request so that our product team
can hear more on such feature request:
http://connect.microsoft.com/feedback/default.aspx?SiteID=210
Again thanks for your posting and understanding!
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Sunday, March 11, 2012

Can Grow crystal report option - does not grow.

Hi.

I am connecting my report file to the domino server. I have a string in the crystal report which is mapped to a text field. the "Can Grow" option is checked but still this string on the report is truncating the data after some 240+ characters.

Any of you have any idea? Your help would be highly appreciatedCheck whether the field has any junk data|||Hi Madhi.

Thanks for your reply. I have checked that there is no junk data in the field...its all simple text...but still the field does not display all of my data in the report. Any idea?.

thanks again for your help.|||Did you try to expand the filed?|||Yes. I expanded the field width. My field is available in the Details Section. I have increased the width but still the complete information does not show up and blank space is displayed from the point the information is truncated.

Can get RDL file name?

Hi,

Is any way can get RDL file name and show on text box?

Any function or something else?

Thanks for any advices!

As the data is tranfered to sql server the report file does not exists anymore as a file. The file that you can download from the web interface is simply composed by reportname + rdl extension.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de|||

The ReportObjectModel exposed to RDL expressions contains several collections (see also: http://msdn2.microsoft.com/en-us/library/ms157274.aspx). One of them is the Globals collections:

Member

Type

Description

ExecutionTime

DateTime

The date and time that the report began to run.

PageNumber

Integer

The current page number. Can be used only in page header and footer.

ReportFolder

String

The full path to the folder containing the report. This does not include the report server URL.

ReportName

String

The name of the report as it is stored in the report server database.

ReportServerUrl

String

The URL of the report server on which the report is being run.

TotalPages

Integer

The total number of pages in the report. Can be used only in page header and footer.

The following expression would show you the path and report name of the current report:

=Globals.ReportFolder & Globals.ReportName

-- Robert

Thursday, March 8, 2012

Can CONTAINSTABLE get its search terms from a table?

(SQL Server 2000, SP3)
Hello all!
We've got an issue with a Full Text Search query that is failing because of too many
search terms in the CONTAINSTABLE clause (upwards of 3000 elements separated with " OR ",
I think).
I was wondering if the CONTAINSTABLE clause could somehow be refactored to obtain its
search terms from a temporary table? I certainly don't see any evidence of this in BOL --
but I thought I'd check here.
Thanks for any help you can provide! :-)
John PetersonJohn,
Are you getting a syntax error on the FTS query? If so, what is the syntax
error? If you reduce the number of terms, i.e., reduce the total length of
the search string, does the error go away? There was a bug in the past
builds of SQL Server in regards to the length of the search string, but it
was fixed in an early SP.
Is the containstable query in a stored procedure or is it an ad hoc query?
You could "refactor" the query to use a temp table of terms, but that would
most likely require cursors or a while loop, both could be detrimental to
the SQL FTS query performance... Instead, try something like this and change
contains to containstable and be careful and use the correct number of
single quotes...
use pubs
go
DROP PROCEDURE usp_FTSearchPubsInfo
go
CREATE PROCEDURE usp_FTSearchPubsInfo ( @.vcSearchText varchar(7800))
AS
declare @.s as varchar (8000)
set @.s='select pub_id, pr_info from pub_info where
contains(pr_info,'+''''+@.vcSearchText+''''+')'
exec (@.s)
go
-- Small / Simple example of mutiple parameters...
EXEC usp_FTSearchPubsInfo '("pulp*") or ("waste" and "paper" or
"wastepaper") or
("recycle* paper") or (("paper slurry") and ("paper sludge")) or
("biodegrad* paper") or
("paper" and "dispos*") or (("paper" near "bleach*") or ("paper" near
"chemical*"))'
go
With usp_FTSearchPubsInfo you can add to the length of the search string up
to 8000 bytes (the max varchar size), but I've not tested this on SQL 2000
SP3 to 8000 bytes, so, your 3000 elements *might* exceed this limit... Give
it a try and let us know...
Regards,
John
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:#faBMtBpDHA.2064@.TK2MSFTNGP11.phx.gbl...
> (SQL Server 2000, SP3)
> Hello all!
> We've got an issue with a Full Text Search query that is failing because
of too many
> search terms in the CONTAINSTABLE clause (upwards of 3000 elements
separated with " OR ",
> I think).
> I was wondering if the CONTAINSTABLE clause could somehow be refactored to
obtain its
> search terms from a temporary table? I certainly don't see any evidence
of this in BOL --
> but I thought I'd check here.
> Thanks for any help you can provide! :-)
> John Peterson
>|||Hello John!
I *was* getting a syntax error in the FTS query -- and it would go away when I removed a
bunch of the search terms. This was the error:
Server: Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near ' "Aberdeen" OR "Acton" OR "Acworth" OR "Addison" OR
"Advance" OR "Ajax" OR "Alameda" OR "Albuquerque" OR "Algonquin" OR "Aliquip'.
The query is an ad-hoc query that gets built by an .ASP application and sent to SQL Server
via an ADOConnection/ADORecordset.
Alas, the string that's being sent is like 20K -- so I think that it far exceeds that 8000
character limit. :-(
Fundamentally, I think we need to change our searching component to ensure that people
can't enter in a billion search terms. But, by the same token, I felt that if we could
fix this relatively quickly/easily, that would be good too.
Any other ideas that we might be able to try?
As always, thank you so much for your help! :-)
John Peterson
"John Kane" <jt-kane@.comcast.net> wrote in message
news:%23qAU02BpDHA.2732@.TK2MSFTNGP11.phx.gbl...
> John,
> Are you getting a syntax error on the FTS query? If so, what is the syntax
> error? If you reduce the number of terms, i.e., reduce the total length of
> the search string, does the error go away? There was a bug in the past
> builds of SQL Server in regards to the length of the search string, but it
> was fixed in an early SP.
> Is the containstable query in a stored procedure or is it an ad hoc query?
> You could "refactor" the query to use a temp table of terms, but that would
> most likely require cursors or a while loop, both could be detrimental to
> the SQL FTS query performance... Instead, try something like this and change
> contains to containstable and be careful and use the correct number of
> single quotes...
> use pubs
> go
> DROP PROCEDURE usp_FTSearchPubsInfo
> go
> CREATE PROCEDURE usp_FTSearchPubsInfo ( @.vcSearchText varchar(7800))
> AS
> declare @.s as varchar (8000)
> set @.s='select pub_id, pr_info from pub_info where
> contains(pr_info,'+''''+@.vcSearchText+''''+')'
> exec (@.s)
> go
> -- Small / Simple example of mutiple parameters...
> EXEC usp_FTSearchPubsInfo '("pulp*") or ("waste" and "paper" or
> "wastepaper") or
> ("recycle* paper") or (("paper slurry") and ("paper sludge")) or
> ("biodegrad* paper") or
> ("paper" and "dispos*") or (("paper" near "bleach*") or ("paper" near
> "chemical*"))'
> go
> With usp_FTSearchPubsInfo you can add to the length of the search string up
> to 8000 bytes (the max varchar size), but I've not tested this on SQL 2000
> SP3 to 8000 bytes, so, your 3000 elements *might* exceed this limit... Give
> it a try and let us know...
> Regards,
> John
>
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:#faBMtBpDHA.2064@.TK2MSFTNGP11.phx.gbl...
> > (SQL Server 2000, SP3)
> >
> > Hello all!
> >
> > We've got an issue with a Full Text Search query that is failing because
> of too many
> > search terms in the CONTAINSTABLE clause (upwards of 3000 elements
> separated with " OR ",
> > I think).
> >
> > I was wondering if the CONTAINSTABLE clause could somehow be refactored to
> obtain its
> > search terms from a temporary table? I certainly don't see any evidence
> of this in BOL --
> > but I thought I'd check here.
> >
> > Thanks for any help you can provide! :-)
> >
> > John Peterson
> >
> >
>|||You're welcome, John
That's the syntax error I suspected you were getting... Yes, I think it
would be a good idea to change your "searching component to ensure that
people can't enter in a billion search terms" as even Google limits the
number of *effective* search terms to 10, even though you can enter as many
search terms as you want. Perhaps adding a "tips" or "help" statement to
your ASP application page might be helpful as well, stating a limit of 10
(or whatever number) of search words are allowed...
Relative to the below stored procedure, and a "quick fix" for this would be
allowing your users to enter a trailing * (asterisk), for example book* - to
find book, books, booking, booked, etc. so that they will not have to enter
all word variations. Note, also add a tip that only a trailing * (asterisk)
is allowed as SQL FTS only supports this syntax...
Regards,
John
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:eUMRMFCpDHA.3612@.TK2MSFTNGP11.phx.gbl...
> Hello John!
> I *was* getting a syntax error in the FTS query -- and it would go away
when I removed a
> bunch of the search terms. This was the error:
> Server: Msg 170, Level 15, State 1, Line 5
> Line 5: Incorrect syntax near ' "Aberdeen" OR "Acton" OR "Acworth" OR
"Addison" OR
> "Advance" OR "Ajax" OR "Alameda" OR "Albuquerque" OR "Algonquin" OR
"Aliquip'.
> The query is an ad-hoc query that gets built by an .ASP application and
sent to SQL Server
> via an ADOConnection/ADORecordset.
> Alas, the string that's being sent is like 20K -- so I think that it far
exceeds that 8000
> character limit. :-(
> Fundamentally, I think we need to change our searching component to ensure
that people
> can't enter in a billion search terms. But, by the same token, I felt
that if we could
> fix this relatively quickly/easily, that would be good too.
> Any other ideas that we might be able to try?
> As always, thank you so much for your help! :-)
> John Peterson
>
> "John Kane" <jt-kane@.comcast.net> wrote in message
> news:%23qAU02BpDHA.2732@.TK2MSFTNGP11.phx.gbl...
> > John,
> > Are you getting a syntax error on the FTS query? If so, what is the
syntax
> > error? If you reduce the number of terms, i.e., reduce the total length
of
> > the search string, does the error go away? There was a bug in the past
> > builds of SQL Server in regards to the length of the search string, but
it
> > was fixed in an early SP.
> >
> > Is the containstable query in a stored procedure or is it an ad hoc
query?
> > You could "refactor" the query to use a temp table of terms, but that
would
> > most likely require cursors or a while loop, both could be detrimental
to
> > the SQL FTS query performance... Instead, try something like this and
change
> > contains to containstable and be careful and use the correct number of
> > single quotes...
> >
> > use pubs
> > go
> > DROP PROCEDURE usp_FTSearchPubsInfo
> > go
> > CREATE PROCEDURE usp_FTSearchPubsInfo ( @.vcSearchText varchar(7800))
> > AS
> > declare @.s as varchar (8000)
> > set @.s='select pub_id, pr_info from pub_info where
> > contains(pr_info,'+''''+@.vcSearchText+''''+')'
> > exec (@.s)
> > go
> >
> > -- Small / Simple example of mutiple parameters...
> > EXEC usp_FTSearchPubsInfo '("pulp*") or ("waste" and "paper" or
> > "wastepaper") or
> > ("recycle* paper") or (("paper slurry") and ("paper sludge")) or
> > ("biodegrad* paper") or
> > ("paper" and "dispos*") or (("paper" near "bleach*") or ("paper" near
> > "chemical*"))'
> > go
> >
> > With usp_FTSearchPubsInfo you can add to the length of the search
string up
> > to 8000 bytes (the max varchar size), but I've not tested this on SQL
2000
> > SP3 to 8000 bytes, so, your 3000 elements *might* exceed this limit...
Give
> > it a try and let us know...
> >
> > Regards,
> > John
> >
> >
> >
> >
> > "John Peterson" <j0hnp@.comcast.net> wrote in message
> > news:#faBMtBpDHA.2064@.TK2MSFTNGP11.phx.gbl...
> > > (SQL Server 2000, SP3)
> > >
> > > Hello all!
> > >
> > > We've got an issue with a Full Text Search query that is failing
because
> > of too many
> > > search terms in the CONTAINSTABLE clause (upwards of 3000 elements
> > separated with " OR ",
> > > I think).
> > >
> > > I was wondering if the CONTAINSTABLE clause could somehow be
refactored to
> > obtain its
> > > search terms from a temporary table? I certainly don't see any
evidence
> > of this in BOL --
> > > but I thought I'd check here.
> > >
> > > Thanks for any help you can provide! :-)
> > >
> > > John Peterson
> > >
> > >
> >
> >
>

Can CONTAINSTABLE be made to match unconditionally?

Say that users searching a Books database are able to search by Author,
Title, and Publisher using three separate text boxes. They can choose to
leave any or all text boxes empty if they do not care to filter by that
particular item.
Say I have a query that looks similar to this:
b.* FROM Books b
INNER JOIN CONTAINSTABLE( Books, Author, @.author) authorRank ON b.BookId =
authorRank.[KEY]
INNER JOIN CONTAINSTABLE( Books, Title, @.title) titleRank ON ( b.BookId =
titleRank.[KEY] )
INNER JOIN CONTAINSTABLE( Books, Publisher, @.publisher) publisherRank ON (
b.BookId = publisherRank.[KEY] )
This works great if the user chooses to enter something in each of the three
text boxes. However, CONTAINSTABLE does not accept an empty string for the
search condition (nor does it accept *, %, or other wildcards except when
searching for a prefix). How can I get the query to unconditionally match
title and publisher if they leave title and publisher blank but type
something for author?
If there is no way to allow any title and publisher to be returned when the
user leaves those text boxes blank, I will need to write a query for if they
type all three text boxes, a query for if they type in none of the text
boxes, a query if they type in just the publisher but not the title or
author, a query... etc. Not a good solution.
How can I achieve the results I want without writing multiple queries?
Thank you.Hi, Greg
Try something like this (untested):
SELECT * FROM Books
WHERE (@.author IS NULL OR BookId IN (
SELECT KEY FROM CONTAINSTABLE(Books, Author, @.author)
)) AND (@.title IS NULL OR BookId IN (
SELECT KEY FROM CONTAINSTABLE(Books, Title, @.title)
)) AND (@.publisher IS NULL OR BookId IN (
SELECT KEY FROM CONTAINSTABLE(Books, Publisher, @.publisher)
))
Razvan|||That doesn't let me use any of the ranking information provided by
CONTAINSTABLE. It may be workable. I may have found some sort of
sp_configure setting that will change the behavior of noise words. I'm not
sure about it yet.
"Razvan Socol" wrote:

> Hi, Greg
> Try something like this (untested):
> SELECT * FROM Books
> WHERE (@.author IS NULL OR BookId IN (
> SELECT KEY FROM CONTAINSTABLE(Books, Author, @.author)
> )) AND (@.title IS NULL OR BookId IN (
> SELECT KEY FROM CONTAINSTABLE(Books, Title, @.title)
> )) AND (@.publisher IS NULL OR BookId IN (
> SELECT KEY FROM CONTAINSTABLE(Books, Publisher, @.publisher)
> ))
> Razvan
>|||> That doesn't let me use any of the ranking information provided by
> CONTAINSTABLE.
In this case, you might want to use something like this (also
untested):
SELECT b.*, x.RANK, y.RANK, z.RANK FROM Books b
LEFT JOIN CONTAINSTABLE(Books, Author, @.author) x ON b.BookID=x.[KEY]
LEFT JOIN CONTAINSTABLE(Books, Title, @.title) y ON b.BookID=y.[KEY]
LEFT JOIN CONTAINSTABLE(Books, Publisher, @.publisher) z ON
b.BookID=z.[KEY]
WHERE (@.author IS NULL OR x.[KEY] IS NOT NULL)
AND (@.title IS NULL OR y.[KEY] IS NOT NULL)
AND (@.publisher IS NULL OR z.[KEY] IS NOT NULL)
Razvan|||If @.author is NULL (or blank), then CONTAINSTABLE will throw an error, which
is pretty much the entire problem here.
"Razvan Socol" wrote:

> In this case, you might want to use something like this (also
> untested):
> SELECT b.*, x.RANK, y.RANK, z.RANK FROM Books b
> LEFT JOIN CONTAINSTABLE(Books, Author, @.author) x ON b.BookID=x.[KEY]
> LEFT JOIN CONTAINSTABLE(Books, Title, @.title) y ON b.BookID=y.[KEY]
> LEFT JOIN CONTAINSTABLE(Books, Publisher, @.publisher) z ON
> b.BookID=z.[KEY]
> WHERE (@.author IS NULL OR x.[KEY] IS NOT NULL)
> AND (@.title IS NULL OR y.[KEY] IS NOT NULL)
> AND (@.publisher IS NULL OR z.[KEY] IS NOT NULL)
> Razvan
>|||> If @.author is NULL (or blank), then CONTAINSTABLE will throw an error [...]
Aha! I told you it was untested... :) I assumed that CONTAINSTABLE will
return an empty resultset when given a NULL search condition.
Obviously, I was wrong.
In this case, we can use a non-existent word instead of NULL, like
this:
SET @.title=ISNULL(@.title,'NotSpecified')
SET @.author=ISNULL(@.author,'NotSpecified')
SET @.publisher=ISNULL(@.publisher,'NotSpecifi
ed')
SELECT b.*, x.RANK, y.RANK, z.RANK FROM Books b
LEFT JOIN CONTAINSTABLE(Books, Author, @.author) x ON b.BookId=x.[KEY]
LEFT JOIN CONTAINSTABLE(Books, Title, @.title) y ON b.BookId=y.[KEY]
LEFT JOIN CONTAINSTABLE(Books, Publisher, @.publisher) z ON
b.BookId=z.[KEY]
WHERE (@.author='NotSpecified' OR x.[KEY] IS NOT NULL)
AND (@.title='NotSpecified' OR y.[KEY] IS NOT NULL)
AND (@.publisher='NotSpecified' OR z.[KEY] IS NOT NULL)
If you think the word "NotSpecified" may appear in a title of a book,
you can change it with another inexisting word.
Razvan

Friday, February 24, 2012

Can an Application be run using a Textbox Hyperlink?

I'd like to be able to run a client-side application by clicking on a text
item in a report, but none of the available Hyperlink actions on the
Navigation properties tab seem to apply. Is there any way to run something
having a filename and command line argument like
"C:\Program Files\TestApp\TestApp.exe param"?
The "param" would be the value of the TextBox.
Thanks!Hi Don,
Thank you for your post!
Based on my scope, I don't think you could run the client application
directly in the Hyperlink.
The workaround is write a html page which include some javascript to run
the client application and you could add the html page url in the Hyperlink.
Hope this will be helpful for you to resolve this issue.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Wei Lu,
It looks like I'd have to pass the value of the textbox as a parameter for
the html page that contains the javascript. Could you point me to an example
where this technique has been used to run a client application?
Thanks,
Don
"Wei Lu" wrote
> Based on my scope, I don't think you could run the client application
> directly in the Hyperlink.
> The workaround is write a html page which include some javascript to run
> the client application and you could add the html page url in the
Hyperlink.
> Hope this will be helpful for you to resolve this issue.
> Sincerely,
> Wei Lu|||Hi Don,
Thank you for the update.
Here is the sample to run your local IIS Manager:
&

var WshShell = new ActiveXObject("WScript.Shell");
var oExec = WshShell.Exec("C:\\WINDOWS\\system32\\inetsrv\\inetmgr.exe");
Hope this will be helpful!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Wei Lu,
Thanks for the example; works like a charm! Even permits passing a command
line argument to the local exe application.
Don
"Wei Lu" wrote in message
> &

>
>
>
>
>
> var WshShell = new ActiveXObject("WScript.Shell");
> var oExec = WshShell.Exec("C:\\WINDOWS\\system32\\inetsrv\\inetmgr.exe");
>
>
>
>|||Hi Don,
Glad to hear the information is helpful.
If you have any questions or concerns, please feel free to let me know.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.

Sunday, February 12, 2012

Can .BCP file open in text editor?

Hello!
I think I have asked this question eariler and I am asking it again. Can
a .BCP file (which is a binary file) be opened in any Text Editor (or
any program)?
Thanks for your help!
*** Sent via Developersdex http://www.examnotes.net ***> I think I have asked this question eariler and I am asking it again. Can
> a .BCP file (which is a binary file) be opened in any Text Editor (or
> any program)?
Yes. It is useful? No.|||Test Test (farooqhs_2000@.yahoo.com) writes:
> I think I have asked this question eariler and I am asking it again. Can
> a .BCP file (which is a binary file) be opened in any Text Editor (or
> any program)?
Yes, but if the file is binary it's better to open it in a hex editor,
at least in an editor which can show files in hex format. One example
is Textpad, http://www.textpad.com. Textpad looks at the file ending,
and defaults to text format, but this is configurable. You can also
opt to open a certain file as binary rather than text.
Whatever you do, be careful with editing binary files. The file could
be mashed completely if you are not careful.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Camel Case

I need to display text in camel case e.g. How Are You....Because of some deign limitation i can't make chnages in my SP. So i need to do it ar SSRS end....Pl let me know if y know the ans...Thanks

Hi Amit,

You can write custom code(embedded code) to distplay the text in Came Case. To do so, go to Report --> Report properties --> Code tab and then write a function that will convert the input text to camel case as required.

The Function for this purpose is shown below

Code Snippet

Public Function ConvertToCamelCase(inputStr) as String
dim inputStrArr
dim tempWord
dim outputStr
dim i
inputStrArr = split(inputStr," ")

for i=0 to UBound(inputStrArr)
tempWord =inputStrArr(i)
tempWord = Ucase(Left( tempWord ,1)) & Right(tempWord,len(tempWord) -1)
if outputStr="" then
outputStr =tempWord
else
outputStr = outputStr & " " & tempWord

end if

Next
return outputStr
End Function


Then right click on the cell where u want to print this string and enter the following expression

Code Snippet

=Code.ConvertToCamelCase("how are you")

Hope it helps.

Rajiv

|||

public function tocamelcase(inputstring) as string
dim inputstrarr
dim outputstr
dim tempstr
dim i
inputstrarr=split(inputstring," ")
for i=0 to UBound(InputStrArr)
tempstr=InputstrArr(i)
tempstr=UCase(left(tempstr,1)) & lcase(right(tempstr,len(tempstr)-1))
if outputstr=" " then
outputstr=tempstr
Else
outputstr=outputstr & " " & tempstr
End if
Next
return outputstr
End fuction

It is throwing Error

An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC30289] Statement cannot appear within a method body. End of method assumed.’.

Can you please corrrect this

Thank you

Raj Deep.A

|||

Hi Raj Deep,

The above error is occuring because of the Typo error in the code. It should be End Function and not End fuction. I have rectified the error below.

Code Snippet

public function tocamelcase(inputstring) as string
dim inputstrarr
dim outputstr
dim tempstr
dim i
inputstrarr=split(inputstring," ")
for i=0 to UBound(InputStrArr)
tempstr=InputstrArr(i)
tempstr=UCase(left(tempstr,1)) & lcase(right(tempstr,len(tempstr)-1))
if outputstr=" " then
outputstr=tempstr
Else
outputstr=outputstr & " " & tempstr
End if
Next
return outputstr
End function

Best Regards,

Rajiv

|||

I am not able to perform below step

=Code.ConvertToCamelCase("how are you")

As soon as i type =Code. (i can't see custom function in the list)....Any comments...

Amit

|||

Hi Amit,

It is O.K. even if the custom function doesn't appear in the list, type it manually and the report should work fine.

Though I am not sure why it doesn't come in the list, even I didn't get my function to come in the list.

Rajiv

|||

ya i tried and it is not working....

=code.ConvertToCamelCase(Fields!salesman_name.Value)...

It's showing in upper case only...

Thanks for your help

|||

ya i tried and it is not working....

=code.ConvertToCamelCase(Fields!salesman_name.Value)...

It's showing in upper case only...

Thanks for your help

|||

Sorry ,i didn't observe that much keenly.

Thank you Rajiv,Code is Working.

|||

Looks like the data in your field is already uppercase. This will uppercase the first letter, and lowercase the rest. I think Rajiv missed the part in red in his first post.

Try this:

Code Snippet

Public Function ConvertToCamelCase(inputStr) as String

dim inputStrArr

dim tempWord

dim outputStr

dim i

inputStrArr = Split(inputStr, " ")

for i = 0 to UBound(inputStrArr)

tempWord = inputStrArr(i)

tempWord = UCase(Left(tempWord, 1)) & LCase(Right(tempWord, len(tempWord) - 1))

if outputStr = "" then

outputStr = tempWord

else

outputStr = outputStr & " " & tempWord

end if

Next

return outputStr

End Function

Then, you can use this in your field's expression.

Code Snippet

=code.ConvertToCamelCase(Fields!salesman_name.Value)

Hope this helps.

Jarret

Calling web service onclick of report column

We have a web service that reads a PDF file into binary and inserts the
binary text in a database, then returns an ID to the record. Is there a way
to call this web service from a Reporting Service Report column? The column
will have an Adobe image in the column and when clicked with call the web
service and read the record from the Database streaming the binary to a
browser window.
Thanks in advance!
RickOn Nov 27, 7:55 am, "Rick" <rfem...@.newsgroups.nospam> wrote:
> We have a web service that reads a PDF file into binary and inserts the
> binary text in a database, then returns an ID to the record. Is there a way
> to call this web service from a Reporting Service Report column? The column
> will have an Adobe image in the column and when clicked with call the web
> service and read the record from the Database streaming the binary to a
> browser window.
> Thanks in advance!
> Rick
You might try looking into using the Custom Code section of the report
(via: Layout tab >> Report drop-down tab >> Report Properties... >>
Code tab). Another long shot might be to use Jump to URL as part of
the Navigation Properties and pass the Web Service parameters as part
of an expression that calls the web service via URL. Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||Ok, I created a class library that makes a call to the web service and
referenced it in the report.
The web service uses system.web.httpresponse to stream the file to a
browser, so in order to make the class library work it required me to pass
in the httpresponse from the calling web page. So I tested that with a test
web site and it works as expected. I tried adding the same code to call the
class library using Custom Code and Navigation URL. The problem I have is
how to get the Httpresponse from the report to pass into the class library,
I made a reference to System.Web.Httpresponse in the report, but when I call
the code or use the navigation url it does not recognize HTTPResponse.
Any suggestions?
Error:
The Hyperlink expression for the image 'image1' contains an error: [BC30691]
'HttpResponse' is a type in 'Web' and cannot be used as an expression.
Navigation URL:
=webservicecall.webservicecall.getpdffile("filepath\filename.pdf",System.Web.HTTPResponse)
"EMartinez" <emartinez.pr1@.gmail.com> wrote in message
news:b5c663d9-9c91-4b50-8b56-bae9ef9f4788@.w34g2000hsg.googlegroups.com...
> On Nov 27, 7:55 am, "Rick" <rfem...@.newsgroups.nospam> wrote:
>> We have a web service that reads a PDF file into binary and inserts the
>> binary text in a database, then returns an ID to the record. Is there a
>> way
>> to call this web service from a Reporting Service Report column? The
>> column
>> will have an Adobe image in the column and when clicked with call the web
>> service and read the record from the Database streaming the binary to a
>> browser window.
>> Thanks in advance!
>> Rick
>
> You might try looking into using the Custom Code section of the report
> (via: Layout tab >> Report drop-down tab >> Report Properties... >>
> Code tab). Another long shot might be to use Jump to URL as part of
> the Navigation Properties and pass the Web Service parameters as part
> of an expression that calls the web service via URL. Hope this helps.
> Regards,
> Enrique Martinez
> Sr. Software Consultant|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||I could use some help. Here is what I have, I created a Class Library that
makes a call to a web service and referenced the class library in the
report, I setup code in the report properties code, The Public function
calls CallWebService2, CallWebService2 makes a call to a the class library
with the web service passing in a pdffiname, an ID Parameter and the
HTTPResponse, the web service in return streams the PDF to the browser, I
put a column on the report that has an adobe icon image, in this column in
the Jump to URL, I put =code.CallWebService(): When I do this the Jump To
URL does nothing. I'm not sure if I'm getting the HTTPResponse correctly.
Report Properties Code:
Public Function CallWebService() as String
CallWebService2()
Return "True"
End Function
Private Function CallWebService2() as Boolean
Dim nservice As New WebServiceCall.WebServiceCall
Dim response1 As System.Web.HttpResponse
WebServiceCall.WebServiceCall.GetPDFFile("filepath\filename",
"parameter1", Response1)
Return True
End Function
"Wei Lu [MSFT]" <weilu@.online.microsoft.com> wrote in message
news:Ks7X3AzMIHA.6940@.TK2MSFTNGHUB02.phx.gbl...
> Hi ,
> How is everything going? Please feel free to let me know if you need any
> assistance.
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Hello Rick,
You could not use the Code in the Jump to URL directly.
You may add a new report which is call the web service to show the
information. And you may use the Jump to URL to the report.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.