473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Querying Indexing Services from ASP.Net page

I am attempting to do the following, query indexing services through SQL
Server

SQL Server 2000/Visual Studio 2003

I have a linked server created called Web_service that points to a Server
running Indexing Services

I have created a stored procedure that is as follows:

CREATE procedure spQueryActivitiesWithIndex

@ActToDate varchar(20) = NULL,
@ActFromDate varchar(20)= NULL,
@CaseNumber varchar(13) = NULL,
@FullText varchar(3000) = NULL,
@OrderBy varchar(50) = NULL

as

declare @SQLStr varchar(2000)

Set @SQLSTR = 'SELECT va.*, LEFT(FILENAME, 21) AS Filename,
LEFT(REVERSE(SUBSTRING(REVERSE(DIRECTORY), 1, CHARINDEX(''\'',
REVERSE(DIRECTORY)) - 1)) ' +
' + ''/'' + FILENAME, 40) AS Relative_Filename, RANK,
HITCOUNT, CHARACTERIZATION FROM OPENQUERY(web_content,' +
'''SELECT FileName, Directory, Rank, Hitcount,
Characterization FROM psc017.docket..SCOPE() WHERE '

if len(@FullText) > 0
Set @SQLSTR = @SQLSTR + ' CONTAINS(''''' + @FullText + ''''') AND '

Set @SQLSTR = @SQLSTR + ' filename <> ''''index.htm'''' ORDER BY rank
desc'') Q' +
' INNER JOIN [Docket].[dbo].[ViewCaseActivityWithFileNameExt] VA on
VA.txtScanFileName = Q.FileName ' +
' WHERE VA.txtActivityType = ''Order'''

if len(@CaseNumber) > 0
Set @SQLSTR = @SQLSTR + ' AND VA.txtCaseNumber like ''%' + @CaseNumber +
'%'''

if Len(@ActToDate) > 0
begin
if Len(@ActFromDate) > 0
Set @SQLSTR = @SQLSTR + ' AND VA.dteActivity between ''' + @ActToDate
+ ''' and ''' + @ActFromDate + ''''
else
Set @SQLSTR = @SQLSTR + ' AND VA.dteActivity = ''' + @ActToDate + ''''
end

if Len(@Orderby) > 0
Set @SQLSTR = @SQLSTR + ' ORDER BY VA.' + @OrderBy

--print @SQLSTR
EXEC (@SQLSTR)

GO

I can run this fine from SQL Server becuase I have admin rights, but when I
run this from within my ASP.Net app with the following code, I get the
following error message.

DsIndex1.Tables("spQueryActivitiesWithIndex").Clea r()

daspQueryActivitiesWithIndex.Fill(DsIndex1, "daspQueryActivitiesWithIndex")

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'(null)'. Reason: Not associated with a trusted SQL Server connection.

I am new to ASP.NET so any help would greatly be apreciated.





Dec 28 '05 #1
7 1966
You need to Add the ASPNET account to the Database you have created the
Index in.

--
Best Regards

The Inimitable Mr Newbie º¿º

"C Jay Pemberton Jr" <jp********@psc.state.wv.us> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I am attempting to do the following, query indexing services through SQL
Server

SQL Server 2000/Visual Studio 2003

I have a linked server created called Web_service that points to a Server
running Indexing Services

I have created a stored procedure that is as follows:

CREATE procedure spQueryActivitiesWithIndex

@ActToDate varchar(20) = NULL,
@ActFromDate varchar(20)= NULL,
@CaseNumber varchar(13) = NULL,
@FullText varchar(3000) = NULL,
@OrderBy varchar(50) = NULL

as

declare @SQLStr varchar(2000)

Set @SQLSTR = 'SELECT va.*, LEFT(FILENAME, 21) AS Filename,
LEFT(REVERSE(SUBSTRING(REVERSE(DIRECTORY), 1, CHARINDEX(''\'',
REVERSE(DIRECTORY)) - 1)) ' +
' + ''/'' + FILENAME, 40) AS Relative_Filename,
RANK,
HITCOUNT, CHARACTERIZATION FROM OPENQUERY(web_content,' +
'''SELECT FileName, Directory, Rank, Hitcount,
Characterization FROM psc017.docket..SCOPE() WHERE '

if len(@FullText) > 0
Set @SQLSTR = @SQLSTR + ' CONTAINS(''''' + @FullText + ''''') AND '

Set @SQLSTR = @SQLSTR + ' filename <> ''''index.htm'''' ORDER BY rank
desc'') Q' +
' INNER JOIN [Docket].[dbo].[ViewCaseActivityWithFileNameExt] VA on
VA.txtScanFileName = Q.FileName ' +
' WHERE VA.txtActivityType = ''Order'''

if len(@CaseNumber) > 0
Set @SQLSTR = @SQLSTR + ' AND VA.txtCaseNumber like ''%' + @CaseNumber +
'%'''

if Len(@ActToDate) > 0
begin
if Len(@ActFromDate) > 0
Set @SQLSTR = @SQLSTR + ' AND VA.dteActivity between ''' + @ActToDate
+ ''' and ''' + @ActFromDate + ''''
else
Set @SQLSTR = @SQLSTR + ' AND VA.dteActivity = ''' + @ActToDate + ''''
end

if Len(@Orderby) > 0
Set @SQLSTR = @SQLSTR + ' ORDER BY VA.' + @OrderBy

--print @SQLSTR
EXEC (@SQLSTR)

GO

I can run this fine from SQL Server becuase I have admin rights, but when
I
run this from within my ASP.Net app with the following code, I get the
following error message.

DsIndex1.Tables("spQueryActivitiesWithIndex").Clea r()

daspQueryActivitiesWithIndex.Fill(DsIndex1,
"daspQueryActivitiesWithIndex")

Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.

I am new to ASP.NET so any help would greatly be apreciated.




Dec 28 '05 #2
Thank you for your prompt reply. I am sorry that I am nieve, but can you
provide links to the steps to add ASPNET user to SQL Server/Database?

Thanks

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Dec 28 '05 #3
I went into SQL Server and tried to add the ASPNET user from my local
machine, but it gave me an error saying Unknown User/Group, so do I need
to have dotnet installed on the SQL Server so that I can use the ASPNET
account there? Is there anything that I have to do on the application
side to facilitate using the ASPNET account besides changing the
machine.config file, I tried that to no avail. Any additional help
would be appreciated.

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Dec 29 '05 #4
This is a Bultin Account so it will be something like BUILTIN\ASPNET

--
Best Regards

The Inimitable Mr Newbie º¿º
"Jay Pemberton" <jp********@psc.state.wv.us> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl...
I went into SQL Server and tried to add the ASPNET user from my local
machine, but it gave me an error saying Unknown User/Group, so do I need
to have dotnet installed on the SQL Server so that I can use the ASPNET
account there? Is there anything that I have to do on the application
side to facilitate using the ASPNET account besides changing the
machine.config file, I tried that to no avail. Any additional help
would be appreciated.

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

Dec 29 '05 #5
I looked at the SQL Server through enterprise manager and tried to add a
user and did a seach for ASPNET and it didnt find a user called
BUILTIN\ASPNET, so does that mean that it dotnet isn't installed on the
SQL Server?

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Dec 29 '05 #6
I looked at the SQL Server through enterprise manager and tried to add a
user and did a seach for ASPNET and it didnt find a user called
BUILTIN\ASPNET, so does that mean that it dotnet isn't installed on the
SQL Server?

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Dec 29 '05 #7
That is possible, but more likely you have not found the account yet.
Alternatively, it may be NT Authority\Network Service

--
Best Regards

The Inimitable Mr Newbie º¿º
"Jay Pemberton" <jp********@psc.state.wv.us> wrote in message
news:u0**************@TK2MSFTNGP12.phx.gbl...
I looked at the SQL Server through enterprise manager and tried to add a
user and did a seach for ASPNET and it didnt find a user called
BUILTIN\ASPNET, so does that mean that it dotnet isn't installed on the
SQL Server?

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

Dec 29 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Jay | last post by:
Hello all. I've recently transferred our web sites from a Windows2000 server to a Windows2003 server. The transfer went almost flawless until I noticed that our search function isn't working...
6
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about...
1
by: Don | last post by:
I am new to Indexing Services, have been researching the MS Site as well as web articles on DevHood, etc. I have set up a seperate catalog ("KnowledgeBase") on Win XP with a number of files. I am...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
3
by: Maury | last post by:
Hi, I would like to know if it's possibile to interact with Windows Server Indexing Services from an ASP.NET page. Thanks M.A.
0
by: Jay.Pemberton | last post by:
I have stored procedure that does the following select into Indexing Services. SELECT LEFT(FILENAME, 21) AS Filename, LEFT(REVERSE(SUBSTRING(REVERSE(DIRECTORY), 1, CHARINDEX('\',...
0
by: Chung Leong | last post by:
Here's a short tutorial on how to the OLE-DB extension to access Windows Indexing Service. Impress your office-mates with a powerful full-text search feature on your intranet. It's easier than you...
2
by: Steven Cheng [MSFT] | last post by:
Hi Cj, I also noticed that the "Act" variable here seems hasn't been declared(or declared anywhere else?). I've try building the same code and got the same result and the "Operator '+' cannot be...
2
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a server 2008 IIS 7.0 with indexing service installed. I have created the catalog and have a test page using these posts:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.