Showing posts with label displaying. Show all posts
Showing posts with label displaying. Show all posts

Friday, March 30, 2012

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.

Friday, March 23, 2012

OPen xml rowpattern probs!

Hi All,

I have this sql syntax which displays the records within the xml but instead of displaying 4 records (3 records relating to the last question ID) but instead resulting in only two records picking only the first options 'Unhelpful'.

Definitely doing something wrong here, please advise!

DECLARE @.doc xml
SET @.doc =
'<DivisionName>
<QuestInfo Custref="18759" SubDate="2006-01-01T00:00:00"
Polref="30018759" AgentID="4189" ClaimRef="14024-5647-890"/>
<DVName>Ho</DVName>
<DvcodeNo>1</DvcodeNo>
<ClaimGroup>
<CustSurveyNo>4</CustSurveyNo>
<ClaimGroupType>Water</ClaimGroupType>
<Questions>
<QuestionID>45</QuestionID>
<Answer>
<AnswerID>43</AnswerID>
<Ansoption />
</Answer>
</Questions>
<Questions>
<QuestionID>34</QuestionID>
<Answer>
<AnswerID>13</AnswerID>
<Ansoption>
<Options>Unhelpful</Options>
</Ansoption>
</Answer>
</Questions>
</ClaimGroup>
</DivisionName>'

DECLARE @.docHandle int

EXEC sp_xml_preparedocument @.docHandle OUTPUT, @.doc

SELECT *
FROM
OPENXML(@.docHandle, '/DivisionName/ClaimGroup/Questions/Answer/
Ansoption', 2)
WITH
(DVName varchar (20) '../../../../DVName',
DvcodeNo int '../../../../DvcodeNo',
CustSurveyNo int '../../../CustSurveyNo',
ClaimGroupType varchar (20) '../../../ClaimGroupType',
QuestionID int '../../QuestionID',
AnswerID int '../AnswerID',
Ansoption varchar (30)'Options')

EXEC sp_xml_removedocument @.docHandleDon't worry all sortedsql

Open Xml

Hi All,

I have this sql syntax which displays the records within the xml but instead of displaying 4 records (3 records relating to the last question ID) but instead resulting in only two records picking only the first options 'Unhelpful'.

Definitely doing something wrong here, please advise!

DECLARE @.doc xml
SET @.doc =
'<DivisionName>
<QuestInfo Custref="18759" SubDate="2006-01-01T00:00:00"
Polref="30018759" AgentID="4189" ClaimRef="14024-5647-890"/>
<DVName>Ho</DVName>
<DvcodeNo>1</DvcodeNo>
<ClaimGroup>
<CustSurveyNo>4</CustSurveyNo>
<ClaimGroupType>Water</ClaimGroupType>
<Questions>
<QuestionID>45</QuestionID>
<Answer>
<AnswerID>43</AnswerID>
<Ansoption />
</Answer>
</Questions>
<Questions>
<QuestionID>34</QuestionID>
<Answer>
<AnswerID>13</AnswerID>
<Ansoption>
<Options>Unhelpful</Options>
</Ansoption>
</Answer>
</Questions>
</ClaimGroup>
</DivisionName>'

DECLARE @.docHandle int

EXEC sp_xml_preparedocument @.docHandle OUTPUT, @.doc

SELECT *
FROM
OPENXML(@.docHandle, '/DivisionName/ClaimGroup/Questions/Answer/
Ansoption', 2)
WITH
(DVName varchar (20) 'http://http://DVName',
DvcodeNo int 'http://http://DvcodeNo',
CustSurveyNo int 'http://../CustSurveyNo',
ClaimGroupType varchar (20) 'http://../ClaimGroupType',
QuestionID int 'http://QuestionID',
AnswerID int '../AnswerID',
Ansoption varchar (30)'Options')

EXEC sp_xml_removedocument @.docHandle

The reason you are only getting two rows in the resultset is because there are only two nodes that match your xpath expression /DivisionName/ClaimGroup/Questions/Answer/Ansoption.

What is the result set that you desire? I'm not certain what the results are you implying when you say you are expecting 4 rows.

Regards,

Galex

|||

Thanks for the reply first of all, luckily I have sorted it out now.

Thanks again

|||

Hi

I am new to xml in sql server. If i have an xml of this type.how do i access the elements in the xml

<skill>

<Coach type="AA">false</Coach>

<CDT type="AA">false</CDT>

<DIT type="AA">false</DIT>

<FSA type="AA">false</FSA>

<LMR type="AA">false</LMR>

<ROSPA type="Additional">false</ROSPA>

<IAM type="Additional">false</IAM>

<Diamond type="Additional">false</Diamond>

<DipDI type="Additional">false</DipDI>

<BTEC type="Additional">false</BTEC>

<QEF type="Additional">

<member>false</member>

<certificatenumber /><level />

</QEF>

<BTec type="Additional">false</BTec>

</skill>

Srini

|||Can you be more specific in your question? E.g. what element you want to access? After you have access, what do you want to do about that element?|||

This is the column in a table that contains the skill set of an individual candidate. on Passing the candidate id , i would access the access and the output i would give is like

coach=false, cdt=false,dit=false,fsa=false, lmr=false,iam=false,qefmemer=false,qefcertificatenumber=null,btec=false.

i would like to query for basic qualification and additional qualifications.

Thanks

Srini

|||

Anonymous wrote:

Hi

I am new to xml in sql server. If i have an xml of this type.how do i access the elements in the xml

<skill>

<Coach type="AA">false</Coach>

<CDT type="AA">false</CDT>

<DIT type="AA">false</DIT>

<FSA type="AA">false</FSA>

<LMR type="AA">false</LMR>

<ROSPA type="Additional">false</ROSPA>

<IAM type="Additional">false</IAM>

<Diamond type="Additional">false</Diamond>

<DipDI type="Additional">false</DipDI>

<BTEC type="Additional">false</BTEC>

<QEF type="Additional">

<member>false</member>

<certificatenumber /><level />

</QEF>

<BTec type="Additional">false</BTec>

</skill>

Srini

<xsl:for-each select="skill/coach/{@.type}>

</xsl:for-each>

sql

Open Xml

Hi All,

I have this sql syntax which displays the records within the xml but instead of displaying 4 records (3 records relating to the last question ID) but instead resulting in only two records picking only the first options 'Unhelpful'.

Definitely doing something wrong here, please advise!

DECLARE @.doc xml
SET @.doc =
'<DivisionName>
<QuestInfo Custref="18759" SubDate="2006-01-01T00:00:00"
Polref="30018759" AgentID="4189" ClaimRef="14024-5647-890"/>
<DVName>Ho</DVName>
<DvcodeNo>1</DvcodeNo>
<ClaimGroup>
<CustSurveyNo>4</CustSurveyNo>
<ClaimGroupType>Water</ClaimGroupType>
<Questions>
<QuestionID>45</QuestionID>
<Answer>
<AnswerID>43</AnswerID>
<Ansoption />
</Answer>
</Questions>
<Questions>
<QuestionID>34</QuestionID>
<Answer>
<AnswerID>13</AnswerID>
<Ansoption>
<Options>Unhelpful</Options>
</Ansoption>
</Answer>
</Questions>
</ClaimGroup>
</DivisionName>'

DECLARE @.docHandle int

EXEC sp_xml_preparedocument @.docHandle OUTPUT, @.doc

SELECT *
FROM
OPENXML(@.docHandle, '/DivisionName/ClaimGroup/Questions/Answer/
Ansoption', 2)
WITH
(DVName varchar (20) 'http://http://DVName',
DvcodeNo int 'http://http://DvcodeNo',
CustSurveyNo int 'http://../CustSurveyNo',
ClaimGroupType varchar (20) 'http://../ClaimGroupType',
QuestionID int 'http://QuestionID',
AnswerID int '../AnswerID',
Ansoption varchar (30)'Options')

EXEC sp_xml_removedocument @.docHandle

The reason you are only getting two rows in the resultset is because there are only two nodes that match your xpath expression /DivisionName/ClaimGroup/Questions/Answer/Ansoption.

What is the result set that you desire? I'm not certain what the results are you implying when you say you are expecting 4 rows.

Regards,

Galex

|||

Thanks for the reply first of all, luckily I have sorted it out now.

Thanks again

|||

Hi

I am new to xml in sql server. If i have an xml of this type.how do i access the elements in the xml

<skill>

<Coach type="AA">false</Coach>

<CDT type="AA">false</CDT>

<DIT type="AA">false</DIT>

<FSA type="AA">false</FSA>

<LMR type="AA">false</LMR>

<ROSPA type="Additional">false</ROSPA>

<IAM type="Additional">false</IAM>

<Diamond type="Additional">false</Diamond>

<DipDI type="Additional">false</DipDI>

<BTEC type="Additional">false</BTEC>

<QEF type="Additional">

<member>false</member>

<certificatenumber /><level />

</QEF>

<BTec type="Additional">false</BTec>

</skill>

Srini

|||Can you be more specific in your question? E.g. what element you want to access? After you have access, what do you want to do about that element?|||

This is the column in a table that contains the skill set of an individual candidate. on Passing the candidate id , i would access the access and the output i would give is like

coach=false, cdt=false,dit=false,fsa=false, lmr=false,iam=false,qefmemer=false,qefcertificatenumber=null,btec=false.

i would like to query for basic qualification and additional qualifications.

Thanks

Srini

|||

Anonymous wrote:

Hi

I am new to xml in sql server. If i have an xml of this type.how do i access the elements in the xml

<skill>

<Coach type="AA">false</Coach>

<CDT type="AA">false</CDT>

<DIT type="AA">false</DIT>

<FSA type="AA">false</FSA>

<LMR type="AA">false</LMR>

<ROSPA type="Additional">false</ROSPA>

<IAM type="Additional">false</IAM>

<Diamond type="Additional">false</Diamond>

<DipDI type="Additional">false</DipDI>

<BTEC type="Additional">false</BTEC>

<QEF type="Additional">

<member>false</member>

<certificatenumber /><level />

</QEF>

<BTec type="Additional">false</BTec>

</skill>

Srini

<xsl:for-each select="skill/coach/{@.type}>

</xsl:for-each>

Wednesday, March 7, 2012

Only render a Document Map and the Report

How can I create a Document Map and a Report without displaying the Report
Manager toolbar?
I tried "&rc:Area=DocMapAndReport" but that had the same effect as
"&rc:Area=Report".
ThanksHi Rick. There's a render command for whether or not to show the toolbar (or
parameters). BOL should have it in there. I can't remember exactly what it
is... Sorry.
-Tim
"Rick" <Rick@.discussions.microsoft.com> wrote in message
news:116EBF29-9088-4CD1-A36D-AE29B1871035@.microsoft.com...
> How can I create a Document Map and a Report without displaying the Report
> Manager toolbar?
> I tried "&rc:Area=DocMapAndReport" but that had the same effect as
> "&rc:Area=Report".
> Thanks
>|||I believe you are thinking about "rc:Toolbar=false".
If you are, using this param will cause the toolbar to not be created and
thus you will not see the document map.
"Tim Dot NoSpam" wrote:
> Hi Rick. There's a render command for whether or not to show the toolbar (or
> parameters). BOL should have it in there. I can't remember exactly what it
> is... Sorry.
> -Tim
>
> "Rick" <Rick@.discussions.microsoft.com> wrote in message
> news:116EBF29-9088-4CD1-A36D-AE29B1871035@.microsoft.com...
> > How can I create a Document Map and a Report without displaying the Report
> > Manager toolbar?
> >
> > I tried "&rc:Area=DocMapAndReport" but that had the same effect as
> > "&rc:Area=Report".
> >
> > Thanks
> >
>
>

Saturday, February 25, 2012

Only displaying the subtotal value in a matrix report.

Is there a way to make it so that a data column in a matrix only displays a value for the subtotal of a field?

If you add a toggle to the matrix column/row group, it will enable to switch between the detailed group instances (when expanded) or show the subtotals only (when collapsed). Take a look at the "Company Sales" sample report in the Adventure Works sample project that comes with RS.

-- Robert