Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Friday, March 30, 2012

network error

Hi,
Running a stored procedure in query analyser returns data but when running the asp.net page which uses that stored procedure returns an exception which is:
General network error. Check your network documentation

Do you know what the problem could be please?
ThanksNetwork errors are your SQL Server is installed with the local systems account which leaves SQL Server Agent without Network permissions. The solution you have to install SQL Server with a service account. Hope this helps.

Kind regards,
Gift Peddie|||Hi,
Are you sure this is the solution?
It's just that the query works for some and not for all of the queries that are passed through the network.
Thanks|||Installing SQL Server with a service account is good practice in all but free standing developer boxes because after SQL Server Service, SQL Server Agent is the next most important service in SQL Server. Some distributed queries will fail and you cannot run Replication because the Local Systems account leaves SQL Server Agent without Network permissions. Hope this helps.

Kind regards,
Gift Peddie

Wednesday, March 21, 2012

Nested Sets Tree Structure

Hi,
I need to store a tree using nested sets (http://www.codeproject.com/
database/nestedsets.asp) in SQL Server 2000.
I've got the database sorted, but ive got a problem reading that
data...
I need to get the data out of the database and into an XML structure
in C# (if anyones got a java example or similar i can translate it)
Can anyone point me at any code or tutorials on how to do this? I
really can't think of a sensible way of doing it, but there must be!
Cheers
Andrew
Hi
"trullock@.hotmail.com" wrote:

> Hi,
>
> I need to store a tree using nested sets (http://www.codeproject.com/
> database/nestedsets.asp) in SQL Server 2000.
> I've got the database sorted, but ive got a problem reading that
> data...
> I need to get the data out of the database and into an XML structure
> in C# (if anyones got a java example or similar i can translate it)
> Can anyone point me at any code or tutorials on how to do this? I
> really can't think of a sensible way of doing it, but there must be!
>
> Cheers
> Andrew
>
Check out http://www.perfectxml.com/Articles/XML/ExportSQLXML.asp
and http://sqlxml.org/faqs.aspx?faq=10
John
|||On 16 Feb, 08:25, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi
>
> "trull...@.hotmail.com" wrote:
>
>
>
> Check outhttp://www.perfectxml.com/Articles/XML/ExportSQLXML.asp
> andhttp://sqlxml.org/faqs.aspx?faq=10
> John
Thanks, that looks like what I need
I've made another post about nested sets and adjacency lists if you
happen to know anything about them too,
Thanks
Andrew
|||Hi
"trullock@.hotmail.com" wrote:

> On 16 Feb, 08:25, John Bell <jbellnewspo...@.hotmail.com> wrote:
>
> Thanks, that looks like what I need
> I've made another post about nested sets and adjacency lists if you
> happen to know anything about them too,
> Thanks
> Andrew
Joe Celko's book "Trees and Hierarchies in SQL for Smarties" ISBN
1-55860-920-2 has just about everything you need for nested sets and you may
want to Google for his posts.
The parent will be the node with the maximum left value less than the
current node's left value and the minimum right values which is greater than
the current node's right value!
John
|||On 16 Feb, 10:05, John Bell <jbellnewspo...@.hotmail.com> wrote:
> The parent will be the node with the maximum left value less than the
> current node's left value and the minimum right values which is greater than
> the current node's right value!
> John
Cool thanks, think I get that.
Is it possible to do that in a single SQL command, or would I have to
use a user defined function like this:
SELECT Node_ID, Left, Right, fn_FindParent(Node_ID) as ParentID FROM
NODES
Im guessing that will be slow :s
Andrew
|||Hi Andrew
"trullock@.hotmail.com" wrote:

> On 16 Feb, 10:05, John Bell <jbellnewspo...@.hotmail.com> wrote:
>
> Cool thanks, think I get that.
> Is it possible to do that in a single SQL command, or would I have to
> use a user defined function like this:
> SELECT Node_ID, Left, Right, fn_FindParent(Node_ID) as ParentID FROM
> NODES
> Im guessing that will be slow :s
> Andrew
>
There may be other ways to get the parent, the speed would really be
dependent on the size of the hierarchy.
If you wanted to do this in one query it would be (using the ddl from the
article):
SELECT e.EmployeeID,
e.ParentID,
(SELECT f.EmployeeID
FROM Employee f WHERE f.LeftExtent =
(SELECT MAX(g.LeftExtent) FROM Employee g WHERE g.LeftExtent < e.LeftExtent
AND g.RightExtent > e.RightExtent )
AND f.RightExtent =
(SELECT Min(g.RightExtent) FROM Employee g WHERE g.RightExtent >
e.RightExtent AND g.LeftExtent < e.LeftExtent )
)
FROM Employee e
As a function:
CREATE Function dbo.fn_GetLevel ( @.LeftExtent int, @.RightExtent int )
RETURNS INT
AS
BEGIN
RETURN ( SELECT f.EmployeeID
FROM Employee f
WHERE f.LeftExtent =
(SELECT MAX(g.LeftExtent) FROM Employee g WHERE g.LeftExtent <
@.LeftExtent AND g.RightExtent > @.RightExtent )
AND f.RightExtent =
(SELECT Min(g.RightExtent) FROM Employee g WHERE g.RightExtent >
@.RightExtent AND g.LeftExtent < @.LeftExtent )
)
END
SELECT e.EmployeeID,
e.ParentID,
dbo.fn_GetLevel ( e.LeftExtent, e.RightExtent )
FROM Employee e
John
sql

Nested Sets Tree Structure

Hi,
I need to store a tree using nested sets (http://www.codeproject.com/
database/nestedsets.asp) in SQL Server 2000.
I've got the database sorted, but ive got a problem reading that
data...
I need to get the data out of the database and into an XML structure
in C# (if anyones got a java example or similar i can translate it)
Can anyone point me at any code or tutorials on how to do this? I
really can't think of a sensible way of doing it, but there must be!
Cheers
AndrewHi
"trullock@.hotmail.com" wrote:
> Hi,
>
> I need to store a tree using nested sets (http://www.codeproject.com/
> database/nestedsets.asp) in SQL Server 2000.
> I've got the database sorted, but ive got a problem reading that
> data...
> I need to get the data out of the database and into an XML structure
> in C# (if anyones got a java example or similar i can translate it)
> Can anyone point me at any code or tutorials on how to do this? I
> really can't think of a sensible way of doing it, but there must be!
>
> Cheers
> Andrew
>
Check out http://www.perfectxml.com/Articles/XML/ExportSQLXML.asp
and http://sqlxml.org/faqs.aspx?faq=10
John|||On 16 Feb, 08:25, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi
>
> "trull...@.hotmail.com" wrote:
> > Hi,
> > I need to store a tree using nested sets (http://www.codeproject.com/
> > database/nestedsets.asp) in SQL Server 2000.
> > I've got the database sorted, but ive got a problem reading that
> > data...
> > I need to get the data out of the database and into an XML structure
> > in C# (if anyones got a java example or similar i can translate it)
> > Can anyone point me at any code or tutorials on how to do this? I
> > really can't think of a sensible way of doing it, but there must be!
> > Cheers
> > Andrew
> Check outhttp://www.perfectxml.com/Articles/XML/ExportSQLXML.asp
> andhttp://sqlxml.org/faqs.aspx?faq=10
> John
Thanks, that looks like what I need :)
I've made another post about nested sets and adjacency lists if you
happen to know anything about them too,
Thanks
Andrew|||Hi
"trullock@.hotmail.com" wrote:
> On 16 Feb, 08:25, John Bell <jbellnewspo...@.hotmail.com> wrote:
> > Hi
> >
> >
> >
> > "trull...@.hotmail.com" wrote:
> > > Hi,
> >
> > > I need to store a tree using nested sets (http://www.codeproject.com/
> > > database/nestedsets.asp) in SQL Server 2000.
> >
> > > I've got the database sorted, but ive got a problem reading that
> > > data...
> >
> > > I need to get the data out of the database and into an XML structure
> > > in C# (if anyones got a java example or similar i can translate it)
> >
> > > Can anyone point me at any code or tutorials on how to do this? I
> > > really can't think of a sensible way of doing it, but there must be!
> >
> > > Cheers
> >
> > > Andrew
> >
> > Check outhttp://www.perfectxml.com/Articles/XML/ExportSQLXML.asp
> > andhttp://sqlxml.org/faqs.aspx?faq=10
> >
> > John
>
> Thanks, that looks like what I need :)
> I've made another post about nested sets and adjacency lists if you
> happen to know anything about them too,
> Thanks
> Andrew
Joe Celko's book "Trees and Hierarchies in SQL for Smarties" ISBN
1-55860-920-2 has just about everything you need for nested sets and you may
want to Google for his posts.
The parent will be the node with the maximum left value less than the
current node's left value and the minimum right values which is greater than
the current node's right value!
John|||On 16 Feb, 10:05, John Bell <jbellnewspo...@.hotmail.com> wrote:
> The parent will be the node with the maximum left value less than the
> current node's left value and the minimum right values which is greater than
> the current node's right value!
> John
Cool thanks, think I get that.
Is it possible to do that in a single SQL command, or would I have to
use a user defined function like this:
SELECT Node_ID, Left, Right, fn_FindParent(Node_ID) as ParentID FROM
NODES
Im guessing that will be slow :s
Andrew|||Hi Andrew
"trullock@.hotmail.com" wrote:
> On 16 Feb, 10:05, John Bell <jbellnewspo...@.hotmail.com> wrote:
> > The parent will be the node with the maximum left value less than the
> > current node's left value and the minimum right values which is greater than
> > the current node's right value!
> >
> > John
>
> Cool thanks, think I get that.
> Is it possible to do that in a single SQL command, or would I have to
> use a user defined function like this:
> SELECT Node_ID, Left, Right, fn_FindParent(Node_ID) as ParentID FROM
> NODES
> Im guessing that will be slow :s
> Andrew
>
There may be other ways to get the parent, the speed would really be
dependent on the size of the hierarchy.
If you wanted to do this in one query it would be (using the ddl from the
article):
SELECT e.EmployeeID,
e.ParentID,
(SELECT f.EmployeeID
FROM Employee f WHERE f.LeftExtent =(SELECT MAX(g.LeftExtent) FROM Employee g WHERE g.LeftExtent < e.LeftExtent
AND g.RightExtent > e.RightExtent )
AND f.RightExtent =(SELECT Min(g.RightExtent) FROM Employee g WHERE g.RightExtent >
e.RightExtent AND g.LeftExtent < e.LeftExtent )
)
FROM Employee e
As a function:
CREATE Function dbo.fn_GetLevel ( @.LeftExtent int, @.RightExtent int )
RETURNS INT
AS
BEGIN
RETURN ( SELECT f.EmployeeID
FROM Employee f
WHERE f.LeftExtent = (SELECT MAX(g.LeftExtent) FROM Employee g WHERE g.LeftExtent <
@.LeftExtent AND g.RightExtent > @.RightExtent )
AND f.RightExtent = (SELECT Min(g.RightExtent) FROM Employee g WHERE g.RightExtent >
@.RightExtent AND g.LeftExtent < @.LeftExtent )
)
END
SELECT e.EmployeeID,
e.ParentID,
dbo.fn_GetLevel ( e.LeftExtent, e.RightExtent )
FROM Employee e
John

Nested Sets Tree Structure

Hi,
I need to store a tree using nested sets (http://www.codeproject.com/
database/nestedsets.asp) in SQL Server 2000.
I've got the database sorted, but ive got a problem reading that
data...
I need to get the data out of the database and into an XML structure
in C# (if anyones got a Java example or similar i can translate it)
Can anyone point me at any code or tutorials on how to do this? I
really can't think of a sensible way of doing it, but there must be!
Cheers
AndrewHi
"trullock@.hotmail.com" wrote:

> Hi,
>
> I need to store a tree using nested sets (http://www.codeproject.com/
> database/nestedsets.asp) in SQL Server 2000.
> I've got the database sorted, but ive got a problem reading that
> data...
> I need to get the data out of the database and into an XML structure
> in C# (if anyones got a Java example or similar i can translate it)
> Can anyone point me at any code or tutorials on how to do this? I
> really can't think of a sensible way of doing it, but there must be!
>
> Cheers
> Andrew
>
Check out http://www.perfectxml.com/Articles/XML/ExportSQLXML.asp
and http://sqlxml.org/faqs.aspx?faq=10
John|||On 16 Feb, 08:25, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi
>
> "trull...@.hotmail.com" wrote:
>
>
>
>
>
>
> Check outhttp://www.perfectxml.com/Articles/XML/ExportSQLXML.asp
> andhttp://sqlxml.org/faqs.aspx?faq=10
> John
Thanks, that looks like what I need
I've made another post about nested sets and adjacency lists if you
happen to know anything about them too,
Thanks
Andrew|||Hi
"trullock@.hotmail.com" wrote:

> On 16 Feb, 08:25, John Bell <jbellnewspo...@.hotmail.com> wrote:
>
> Thanks, that looks like what I need
> I've made another post about nested sets and adjacency lists if you
> happen to know anything about them too,
> Thanks
> Andrew
Joe Celko's book "Trees and Hierarchies in SQL for Smarties" ISBN
1-55860-920-2 has just about everything you need for nested sets and you may
want to Google for his posts.
The parent will be the node with the maximum left value less than the
current node's left value and the minimum right values which is greater tha
n
the current node's right value!
John|||On 16 Feb, 10:05, John Bell <jbellnewspo...@.hotmail.com> wrote:
> The parent will be the node with the maximum left value less than the
> current node's left value and the minimum right values which is greater t
han
> the current node's right value!
> John
Cool thanks, think I get that.
Is it possible to do that in a single SQL command, or would I have to
use a user defined function like this:
SELECT Node_ID, Left, Right, fn_FindParent(Node_ID) as ParentID FROM
NODES
Im guessing that will be slow :s
Andrew|||Hi Andrew
"trullock@.hotmail.com" wrote:

> On 16 Feb, 10:05, John Bell <jbellnewspo...@.hotmail.com> wrote:
>
> Cool thanks, think I get that.
> Is it possible to do that in a single SQL command, or would I have to
> use a user defined function like this:
> SELECT Node_ID, Left, Right, fn_FindParent(Node_ID) as ParentID FROM
> NODES
> Im guessing that will be slow :s
> Andrew
>
There may be other ways to get the parent, the speed would really be
dependent on the size of the hierarchy.
If you wanted to do this in one query it would be (using the ddl from the
article):
SELECT e.EmployeeID,
e.ParentID,
(SELECT f.EmployeeID
FROM Employee f WHERE f.LeftExtent =
(SELECT MAX(g.LeftExtent) FROM Employee g WHERE g.LeftExtent < e.LeftExtent
AND g.RightExtent > e.RightExtent )
AND f.RightExtent =
(SELECT Min(g.RightExtent) FROM Employee g WHERE g.RightExtent >
e.RightExtent AND g.LeftExtent < e.LeftExtent )
)
FROM Employee e
As a function:
CREATE Function dbo.fn_GetLevel ( @.LeftExtent int, @.RightExtent int )
RETURNS INT
AS
BEGIN
RETURN ( SELECT f.EmployeeID
FROM Employee f
WHERE f.LeftExtent =
(SELECT MAX(g.LeftExtent) FROM Employee g WHERE g.LeftExtent <
@.LeftExtent AND g.RightExtent > @.RightExtent )
AND f.RightExtent =
(SELECT Min(g.RightExtent) FROM Employee g WHERE g.RightExtent >
@.RightExtent AND g.LeftExtent < @.LeftExtent )
)
END
SELECT e.EmployeeID,
e.ParentID,
dbo.fn_GetLevel ( e.LeftExtent, e.RightExtent )
FROM Employee e
John

Friday, March 9, 2012

Neewbie Question about SQL 2005 and MySql

Can both be run on the same service I have a asp.net application that need to use the MS sql 2005 and I have another application PHP that requires MySql. Can bot be run ont hte same server at the same time?

Yes, you can run both on the same machine at the same time. They act as separate services, and are completely unaware of eachother.

Wednesday, March 7, 2012

Needed: User, Login, Connection advice.

HI,
I'm still on the steep side of the learning curve with ASP.NET. I've looked through a number of threads on this forum, and have gotten pieces of the answer, but need help getting past a roadblock.

I haven't been able to get a simple test application to connect to the Pubs database loaded on my system running MSDE. The only control in the application is a WebDataForm created by the Wizard. Everything works well (even the Preview Data form the Data menu loads and displays the correct data), except when the form is viewed in a browser. Click the load button and an error:Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Similar stories are common on this forum, and I tried to address the problem. I'm quite sure it's a autherization or authentication problem. I have Windows Server 2003 (with IIS 6.0), VS.NET 03 and MSDE as the SQL server on the same box. The MSDE server is using Windows Security mode. I Created a new user called ASPNET on the Windows Server. I added a login to the SQL Server 'WinServerName\ASPNET' using windows auth. Still get the same login failed message.

Is there something I'm missing? Do I have to add a new user to IIS?

For the record, what users/settings do I need to have in Windows, SQL-Server and IIS, get past this login problem.

Thanks for answering this basic question - one more time.Hi,
An Addendum to my message:

I found out that WINDOWS SERVER 2003 in native mode (default), running IIS 6.0 Uses "NETWORK SERVICE" rather than "ASPNET" as the default login user name for ASP.NET applications. I had not seen this in the messages I looked through in this forum.

When I, after a number of dead ends, created a new Login for my SQL Server - (as I'm using MSDE, I used The Web Data Administrator rather than Enterprise Manager or OSQL to create the new login) - with the name 'NT AUTHORITY\NETWORK SERVICE', the application was able to access the database through the VS and IE browswers.

As this test application is only used locally, I'm not concerned with the security ramifications of this method of access. However, I can see that it will be a big concern, and a lot of work to establish the appropriate methods when I have a production application to deploy.

I still would welcome advice on what strategies you have used to provide appropriate access privilages to ASP.NET applications and users that will need to access data from SQL Server databases in production environments.

I know that this is asking a lot - as there are so many permutations to consider. What I would hope you could provide, is a base line of "must" and "must never" stepsfor establishing data connections to data sources using ASP.NET.

If this is too open ended a question - let me know your thoughts on that as well. In looking through the messages of the past 3 months on this forum, I know that many have been frustrated by the complxity of getting a database connection established. Yes, the information to get it done is out there, but the sheer volume can be daunting.

Thanks for all you help with my questions.

Saturday, February 25, 2012

Need urgent help about sql connection denied

From the same web server to sql server, ASP pages work fine, but .NET pages get "SQL Server does not exist or access denied" error message.
Environment:
both are Windows 2000 sp4,
sql server 2000 sp4
not firewall between
Everything is okay before I got some windows security updates fails on the sql server! and I reboot the sql server!
What happened with the security update? Why does it only effect the .NET pages not the ASP pages? They even use the same connection string!
Thanks for any comment

Are you using integrated security? That is, are you passing in a user name and password (in which case you are using SQL Server security) or not (in which case you are using integrated security). ASP and ASP.NET operate under different security contexts. ASP operates as IUSR_<machinename>, whereas ASP.NET operates under the security context of the ASPNET windows user.

I have no idea what the security update would have done.

|||

Thanks for the reply.
I do pass a user name and password in the connection string. it's the same string that I used in the ASP pages. it works fine. But I reboot the servers, only the ASP pages work.
the string looks like "DATABASE=fansion;server=dbsvr; uid=sa; pwd=password;"

|||Just tested, this problam only happens on the windows 2000 web server, windows 2003 is fine.|||

Did you ever get an answer for this re: sql connection - same string works under asp, not under asp.net, with userid= and password= and not with a dsn?

thanks a lot

Neil Jay warner

Monday, February 20, 2012

need to write from asp.net to XML type in SQL Server 2005

Hello, I have worked with SQL Server 2000 but now we have a requirement where I need to write values from an asp.net form into an XML type in SQL Server 2005.

I have never used XML as a type in SQL Server 2005. How do we write xml into xml type.

For example the structure of XML is something like:

<application>

<applicationID = "value"></applicationID>

<customerName="value></customerName>

</application>

I have to write this kind of XML into the XML type and later retrieve these XML values and populate the form again.

Kindly suggest. Thanks a lot.

You will need to look into several things to help you achieve this.

Look into the System.Xml.XmlTextWriter to help you construct XML valid strings

Also look into System.IO.StreamWriter to write the stream of data

You can then use methods of the XmlTextWriter to write the elements, attributes based on your XML structure; WriteStartDocument(), WriteStartElement(), WriteElementString();