Showing posts with label northwind. Show all posts
Showing posts with label northwind. Show all posts

Wednesday, March 21, 2012

error in sql

Sir,
I encounter the error page when tried to display the
data from northwind database in a datagrid in aspx
application. The error page I get is as follows:
server error in '/myview' application
Login failed for user 'NT Authority\Network Service'
Exception details :System.Data.SqlClient.SqlException:
Login failed for user 'NT Authority\Network Service'
Please give a good solution for this.
I'm using sql server 2000 in .net 2003 serverThe most complete resource on securing asp.net when working with SQL
Server is the best practices whitepaper, which you can download at
http://www.microsoft.com/downloads/release.asp?ReleaseID=44047. It
sounds like you have system instead of machine specified as the
processmodel element (a security no-no). Open the Machine.config file
in Notepad and change the userName attribute to MACHINE. Save and then
enable the ASPNET account in SQL Server and grant it membership in any
roles you need.
-- Mary
MCW Technologies
http://www.mcwtech.com
On Tue, 13 Jan 2004 03:50:11 -0800, "ramadevi"
<anonymous@.discussions.microsoft.com> wrote:
>Sir,
> I encounter the error page when tried to display the
>data from northwind database in a datagrid in aspx
>application. The error page I get is as follows:
> server error in '/myview' application
> Login failed for user 'NT Authority\Network Service'
>Exception details :System.Data.SqlClient.SqlException:
> Login failed for user 'NT Authority\Network Service'
>
>Please give a good solution for this.
> I'm using sql server 2000 in .net 2003 server

Monday, March 19, 2012

error in sql

Sir,
I encounter the error page when tried to display the
data from northwind database in a datagrid in aspx
application. The error page I get is as follows:
server error in '/myview' application
Login failed for user 'NT Authority\Network Service'
Exception details :System.Data.SqlClient.SqlException:
Login failed for user 'NT Authority\Network Service'
Please give a good solution for this.
I'm using sql server 2000 in .net 2003 serverThe most complete resource on securing asp.net when working with SQL
Server is the best practices whitepaper, which you can download at
http://www.microsoft.com/downloads/...eleaseID=44047. It
sounds like you have system instead of machine specified as the
processmodel element (a security no-no). Open the Machine.config file
in Notepad and change the userName attribute to MACHINE. Save and then
enable the ASPNET account in SQL Server and grant it membership in any
roles you need.
-- Mary
MCW Technologies
http://www.mcwtech.com
On Tue, 13 Jan 2004 03:50:11 -0800, "ramadevi"
<anonymous@.discussions.microsoft.com> wrote:
quote:

>Sir,
> I encounter the error page when tried to display the
>data from northwind database in a datagrid in aspx
>application. The error page I get is as follows:
> server error in '/myview' application
> Login failed for user 'NT Authority\Network Service'
>Exception details :System.Data.SqlClient.SqlException:
> Login failed for user 'NT Authority\Network Service'
>
>Please give a good solution for this.
> I'm using sql server 2000 in .net 2003 server

Error in sample Northwind?

When I was doing DAO in Access I made sure that my table names did not =
contain any spaces for if they did I had to write my "SQL" statements a =
little differently.
I was following an exmple and had a SQL statment:
sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2" This is in ASP with =
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. =
But if you go to the tables in the Northwind database in SQL 2000 it is =
shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. =
So what I am wondering is when tables in SQL 2000 contain spaces like =
the above Order Deatails, is the SQL statement as I have written it =
irrelevant? Shouldn't it be:
sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2"
?
Thanks.
--=20
George Hester
__________________________________
Hi,
Use SQARE brackets [] incase if you have space inbetwen the object names.
sSQL1 = "UPDATE [Order Details] SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
Thanks
Hari
MCDBA
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:e#lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not
contain any spaces for if they did I had to write my "SQL" statements a
little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
This is in ASP with Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But
if you go to the tables in the Northwind database in SQL 2000 it is shown as
Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So
what I am wondering is when tables in SQL 2000 contain spaces like the above
Order Deatails, is the SQL statement as I have written it irrelevant?
Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
?
Thanks.
George Hester
__________________________________
|||The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL Server also support square
brackets. I prefer the ANSI SQL Compliant way.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not contain any spaces for if they did I
had to write my "SQL" statements a little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2" This is in ASP with
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But if you go to the tables in the
Northwind database in SQL 2000 it is shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So what I am wondering is when tables
in SQL 2000 contain spaces like the above Order Deatails, is the SQL statement as I have written it
irrelevant? Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
?
Thanks.
George Hester
__________________________________
|||OK then it would be:
sSQL1 =3D "UPDATE ""Order Details"" SET Quantity=3D5 WHERE OrderID=3D3 =
AND ProductID=3D2"
for VBScript?
--=20
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote =
in message news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside =
double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
>=20
> --=20
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>=20
>=20
> "George Hester" <hesterloli@.hotmail.com> wrote in message =
news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not =
contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
>=20
> I was following an exmple and had a SQL statment:
>=20
> sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
>=20
> Anyway if you look at this statement the table is called OrderDetails. =
But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the =
space.
>=20
> This is the only table in the Northwind database that conatins a =
space. So what I am wondering is when tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL =
statement as I have written it
> irrelevant? Shouldn't it be:
>=20
> sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 =
AND ProductID=3D2"
> ?
> Thanks.
>=20
> --=20
> George Hester
> __________________________________
>=20
>
|||Yep. Better yet, always quality the object name with the owner. :-)
UPDATE dbo."Order Details" SET...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:ujt2XRFQEHA.3220@.TK2MSFTNGP09.phx.gbl...
OK then it would be:
sSQL1 = "UPDATE ""Order Details"" SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
for VBScript?
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
> I was following an exmple and had a SQL statment:
> sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
> Anyway if you look at this statement the table is called OrderDetails. But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the space.
> This is the only table in the Northwind database that conatins a space. So what I am wondering is when
tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL statement as I have written it
> irrelevant? Shouldn't it be:
> sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
> ?
> Thanks.
> --
> George Hester
> __________________________________
>

Error in sample Northwind?

When I was doing DAO in Access I made sure that my table names did not = contain any spaces for if they did I had to write my "SQL" statements a = little differently.
I was following an exmple and had a SQL statment:
sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND = ProductID=3D2" This is in ASP with = Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. = But if you go to the tables in the Northwind database in SQL 2000 it is = shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. = So what I am wondering is when tables in SQL 2000 contain spaces like = the above Order Deatails, is the SQL statement as I have written it = irrelevant? Shouldn't it be:
sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 AND = ProductID=3D2"
?
Thanks.
-- George Hester
__________________________________Hi,
Use SQARE brackets [] incase if you have space inbetwen the object names.
sSQL1 = "UPDATE [Order Details] SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
Thanks
Hari
MCDBA
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:e#lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not
contain any spaces for if they did I had to write my "SQL" statements a
little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
This is in ASP with Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But
if you go to the tables in the Northwind database in SQL 2000 it is shown as
Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So
what I am wondering is when tables in SQL 2000 contain spaces like the above
Order Deatails, is the SQL statement as I have written it irrelevant?
Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
?
Thanks.
--
George Hester
__________________________________|||The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL Server also support square
brackets. I prefer the ANSI SQL Compliant way.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not contain any spaces for if they did I
had to write my "SQL" statements a little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2" This is in ASP with
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But if you go to the tables in the
Northwind database in SQL 2000 it is shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So what I am wondering is when tables
in SQL 2000 contain spaces like the above Order Deatails, is the SQL statement as I have written it
irrelevant? Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
?
Thanks.
--
George Hester
__________________________________|||OK then it would be:
sSQL1 =3D "UPDATE ""Order Details"" SET Quantity=3D5 WHERE OrderID=3D3 =AND ProductID=3D2"
for VBScript?
-- George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote =in message news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside =double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
> > -- > Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> > > "George Hester" <hesterloli@.hotmail.com> wrote in message =news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not =contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
> > I was following an exmple and had a SQL statment:
> > sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =ProductID=3D2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
> > Anyway if you look at this statement the table is called OrderDetails. = But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the =space.
> > This is the only table in the Northwind database that conatins a =space. So what I am wondering is when tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL =statement as I have written it
> irrelevant? Shouldn't it be:
> > sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 =AND ProductID=3D2"
> ?
> Thanks.
> > -- > George Hester
> __________________________________
> >|||Yep. Better yet, always quality the object name with the owner. :-)
UPDATE dbo."Order Details" SET...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:ujt2XRFQEHA.3220@.TK2MSFTNGP09.phx.gbl...
OK then it would be:
sSQL1 = "UPDATE ""Order Details"" SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
for VBScript?
--
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
> I was following an exmple and had a SQL statment:
> sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
> Anyway if you look at this statement the table is called OrderDetails. But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the space.
> This is the only table in the Northwind database that conatins a space. So what I am wondering is when
tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL statement as I have written it
> irrelevant? Shouldn't it be:
> sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
> ?
> Thanks.
> --
> George Hester
> __________________________________
>

Error in sample Northwind?

When I was doing DAO in Access I made sure that my table names did not =
contain any spaces for if they did I had to write my "SQL" statements a =
little differently.
I was following an exmple and had a SQL statment:
sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2" This is in ASP with =
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. =
But if you go to the tables in the Northwind database in SQL 2000 it is =
shown as Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. =
So what I am wondering is when tables in SQL 2000 contain spaces like =
the above Order Deatails, is the SQL statement as I have written it =
irrelevant? Shouldn't it be:
sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2"
?
Thanks.
--=20
George Hester
__________________________________Hi,
Use SQARE brackets [] incase if you have space inbetwen the object names
.
sSQL1 = "UPDATE [Order Details] SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
Thanks
Hari
MCDBA
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:e#lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not
contain any spaces for if they did I had to write my "SQL" statements a
little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
This is in ASP with Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But
if you go to the tables in the Northwind database in SQL 2000 it is shown as
Order Details. Note the space.
This is the only table in the Northwind database that conatins a space. So
what I am wondering is when tables in SQL 2000 contain spaces like the above
Order Deatails, is the SQL statement as I have written it irrelevant?
Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND
ProductID=2"
?
Thanks.
George Hester
__________________________________|||The ANSI SQL compliant way is to enclose the name inside double-quotes. SQL
Server also support square
brackets. I prefer the ANSI SQL Compliant way.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPEHA
.2128@.TK2MSFTNGP11.phx.gbl...
When I was doing DAO in Access I made sure that my table names did not conta
in any spaces for if they did I
had to write my "SQL" statements a little differently.
I was following an exmple and had a SQL statment:
sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=2"
This is in ASP with
Server.CreateObject("ADODB.Connection")
Anyway if you look at this statement the table is called OrderDetails. But
if you go to the tables in the
Northwind database in SQL 2000 it is shown as Order Details. Note the space
.
This is the only table in the Northwind database that conatins a space. So
what I am wondering is when tables
in SQL 2000 contain spaces like the above Order Deatails, is the SQL stateme
nt as I have written it
irrelevant? Shouldn't it be:
sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND ProductID
=2"
?
Thanks.
George Hester
__________________________________|||OK then it would be:
sSQL1 =3D "UPDATE ""Order Details"" SET Quantity=3D5 WHERE OrderID=3D3 =
AND ProductID=3D2"
for VBScript?
--=20
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote =
in message news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside =
double-quotes. SQL Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
>=20
> --=20
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>=20
>=20
> "George Hester" <hesterloli@.hotmail.com> wrote in message =
news:e%23lSISoPEHA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not =
contain any spaces for if they did I
> had to write my "SQL" statements a little differently.
>=20
> I was following an exmple and had a SQL statment:
>=20
> sSQL1 =3D "UPDATE OrderDetails SET Quantity=3D5 WHERE OrderID=3D3 AND =
ProductID=3D2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
>=20
> Anyway if you look at this statement the table is called OrderDetails. =
But if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the =
space.
>=20
> This is the only table in the Northwind database that conatins a =
space. So what I am wondering is when tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL =
statement as I have written it
> irrelevant? Shouldn't it be:
>=20
> sSQL1 =3D "UPDATE 'Order Details' SET Quantity=3D5 WHERE OrderID=3D3 =
AND ProductID=3D2"
> ?
> Thanks.
>=20
> --=20
> George Hester
> __________________________________
>=20
>|||Yep. Better yet, always quality the object name with the owner. :-)
UPDATE dbo."Order Details" SET...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Hester" <hesterloli@.hotmail.com> wrote in message news:ujt2XRFQEHA.3
220@.TK2MSFTNGP09.phx.gbl...
OK then it would be:
sSQL1 = "UPDATE ""Order Details"" SET Quantity=5 WHERE OrderID=3 AND Product
ID=2"
for VBScript?
George Hester
__________________________________
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message
news:e519lOxPEHA.1644@.TK2MSFTNGP09.phx.gbl...
> The ANSI SQL compliant way is to enclose the name inside double-quotes. SQ
L Server also support square
> brackets. I prefer the ANSI SQL Compliant way.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "George Hester" <hesterloli@.hotmail.com> wrote in message news:e%23lSISoPE
HA.2128@.TK2MSFTNGP11.phx.gbl...
> When I was doing DAO in Access I made sure that my table names did not con
tain any spaces for if they did I
> had to write my "SQL" statements a little differently.
> I was following an exmple and had a SQL statment:
> sSQL1 = "UPDATE OrderDetails SET Quantity=5 WHERE OrderID=3 AND ProductID=
2" This is in ASP with
> Server.CreateObject("ADODB.Connection")
> Anyway if you look at this statement the table is called OrderDetails. Bu
t if you go to the tables in the
> Northwind database in SQL 2000 it is shown as Order Details. Note the spa
ce.
> This is the only table in the Northwind database that conatins a space. So what I
am wondering is when
tables
> in SQL 2000 contain spaces like the above Order Deatails, is the SQL state
ment as I have written it
> irrelevant? Shouldn't it be:
> sSQL1 = "UPDATE 'Order Details' SET Quantity=5 WHERE OrderID=3 AND Product
ID=2"
> ?
> Thanks.
> --
> George Hester
> __________________________________
>

Sunday, February 26, 2012

Error in DataList test query - sqlserver

Error in DataList test query - sqlserver
I found some vs 2005 asp.net walkthroughs.
The first I tried required Northwind.
But sqlserver 2005 came with AdventureWorks, so I used that instead.

I followed the walkthrough instructions, dragging a DataList to Design, and clicking the smart tag to configure my datasource.


sqldatasource=SqlDataSource1
connection string - Data Source=YOUR-02910F1DF1;Initial Catalog=AdventureWorks;Integrated Security=True
I tried the test query.
There was an error executing the query....
Invalid name '[Employee}
I tried the query builder, and then the second line is my own sql statement. Both produced the error above.

SELECT [EmployeeID], [Title] FROM [Employee]
SELECT [EmployeeID], [Title] FROM Employee

I tried this with several different tables, all producing the same error.

When I do with with an access database with an access datasource, it works fine. But since I really want to put something on the web, I need sqlserver 2005.

I confirmed that sqlserver.exe was running.

Can somebody help me?

dennist685

I'd really appreciate an answer to this question. I can't go very far in web applications if I can't attach a datasource to a DataList.

dennist685|||

I got an answer from of all places, the 2003 newsgroups.

Hi Dennist685,

Welcome to ASPNET newsgroup.
From your description, when you try creating a data-driven page in ASP.NET
2.0/VS.NET 2005, you always get error on test query, yes?

Based on my experience, the VS.NET 2005 will use configuration wizard to
help create Sql query statements for our SqlDataSource control. Are you
following the wizard to configure the datasoruce? We can first confirm that
the SqlDataSource is configured correctly. We can open the aspx after
configured the sqldatasource control and check the sql query statement
embeded (test in SQLServer's query console/analyzer to see whether it
works....).

After the SqlDataSource is configured OK, we can then attach it to the
DataList control so as to displaying data.

BTW, for Northwind and Pubs databases, we can manually copy their mdf file
from the original SQLServer 2000 and manually attach them into SQLServer
2005. Also, VS.NET 2005/ .net 2.0 support sqlserver 7.0 2005 (also
include a SQLExpress edition which replace the original MSDE). So please
feel free to use either of them for your data store.

If there're anything unclear or need any further help, please feel free to
post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Thank you Steven,

I never got as far as configuring the datasource correctly.

There was an error executing the (test) query. Please check the syntax of the command and if present, the types and values of the parameters to be sure they are correct.

Invalid name 'Employee'

There is no stack trace. I was in the configuration stage where the wizard asks you to perform a test query.

I went ahead and built default.aspx successfully,

But when I tried to view it in a browser, I got the stack trace you wanted.


Server Error in '/FormatDataList' Application.
--

Invalid object name 'Employee'.
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: Invalid object name 'Employee'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Invalid object name 'Employee'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2300
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
System.Data.SqlClient.SqlDataReader.get_MetaData() +62
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +294
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1021
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +20
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +107
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +10
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +7
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +139
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +140
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1657
System.Web.UI.WebControls.BaseDataList.GetData() +53
System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +267
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +57
System.Web.UI.WebControls.BaseDataList.DataBind() +62
System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +55
System.Web.UI.WebControls.BaseDataList.CreateChildControls() +62
System.Web.UI.Control.EnsureChildControls() +97
System.Web.UI.Control.PreRenderRecursiveInternal() +50
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5729


--
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

dennist685

hank you for the detailed response Dennis,

After tested through your further description, I've reproduce the problem

you encountered. Yes, when using the SqlDataSource's configuration wizard

to generate select statement by "specify columns from a table or view", the

generated SQL statement always cause Error.

And based on my further research, I think this should be a problem of the

SqlDataSource control's configuration wizard. Because for SQL 2005 tables,

they could be grouped by a new unit called "Schema", so when we reference a

table in our SQLStatement , we can not simply use their tablename, but need

to add the schema name together . for example, in our problem, the

Adventureworks database's Employee table are in a schema named

"HumanResources", then, our sql statement should be

"SELECT HumanResources.Employee.* FROM HumanResources.Employee"

or "SELECT * FROM HumanResources.Employee"

rather than "Select * from Employee", "HumanResources" is the schema name.

And seems the SqlDataSource control's

"specify columns from a table or view" wizard dosn't support this

correctly. I'll report this issue to our product team. Curently, I suggest

you try the following means to workaround this problem when dealing with

the SQL2005 database tables:

1. We can manually adjust the sql statement in web page (aspx )'s template

by adding the Schema name before the table name.

2. Instead of using the "specify columns from a table or view" in the

wizard, we can choose another option

"specify a custom SQL statement or stored procedure"

in this wizard, we can use another SQL statement generating tool (Query

Builder ) to auto generate the sql statement (which will correctly add the

Schema name for SQL 2005 data tables based on my tests). Or we can manually

enter sqlstatement also.

Anyway, since this is a problem of our product , I'm sorry for the

inconvenience it brings you. Thanks for your understanding.

Steven Cheng

Microsoft Online Support

Get Secure! www.microsoft.com/security

(This posting is provided "AS IS", with no warranties, and confers no

rights.)

Steven,

thank you every so much for the time you spent tracing down the bug. Frankly, I'm very disappointed in Visual Studio for this and other problems, especially in asp.net 2.0.

Also thank you for solving the problems.

There are also problems I found with other asp.net walkthroughs, but those I found easy ways around.

I find it interesting that the people in Microsoft asp.net forums and Microsoft technical forums couldn't answer the question, and you people, still concentrating of vs 2003, did.

dennist685


|||Thank you Dennis for posting the answer you got; the same problem has been driving me crazy for couple of days. At some point I thought it might be the naming issue but when I got the same error in testing it from the query builder (which I assumed is doing its job right) I did not pursue that direction further.
I don't understand why the common logic was not used - i.e., as long as the name is unque you don't have to qualify it.

Arie|||There's still a problem. The query builder doesn't support WHERE and other clauses. So I guess we have to use the table name and type in the schema qualifier.

It's really disappointing. I don't see how the visual studio team overlooked something so glaring. I imagine in the advanced areas there are bugs galore.

I'd bet SP1 is coming soon.

dennist685

Error in DataList test query - sqlserver

Error in DataList test query - sqlserver
I found some vs 2005 asp.net walkthroughs.
The first I tried required Northwind.
But sqlserver 2005 came with AdventureWorks, so I used that instead.

I followed the walkthrough instructions, dragging a DataList to Design, and clicking the smart tag to configure my datasource.


sqldatasource=SqlDataSource1
connection string - Data Source=YOUR-02910F1DF1;Initial Catalog=AdventureWorks;Integrated Security=True
I tried the test query.
There was an error executing the query....
Invalid name '[Employee}
I tried the query builder, and then the second line is my own sql statement. Both produced the error above.

SELECT [EmployeeID], [Title] FROM [Employee]
SELECT [EmployeeID], [Title] FROM Employee

I tried this with several different tables, all producing the same error.

When I do with with an access database with an access datasource, it works fine. But since I really want to put something on the web, I need sqlserver 2005.

I confirmed that sqlserver.exe was running.

Can somebody help me?

dennist685

I'd really appreciate an answer to this question. I can't go very far in web applications if I can't attach a datasource to a DataList.

dennist685|||

I got an answer from of all places, the 2003 newsgroups.

Hi Dennist685,

Welcome to ASPNET newsgroup.
From your description, when you try creating a data-driven page in ASP.NET
2.0/VS.NET 2005, you always get error on test query, yes?

Based on my experience, the VS.NET 2005 will use configuration wizard to
help create Sql query statements for our SqlDataSource control. Are you
following the wizard to configure the datasoruce? We can first confirm that
the SqlDataSource is configured correctly. We can open the aspx after
configured the sqldatasource control and check the sql query statement
embeded (test in SQLServer's query console/analyzer to see whether it
works....).

After the SqlDataSource is configured OK, we can then attach it to the
DataList control so as to displaying data.

BTW, for Northwind and Pubs databases, we can manually copy their mdf file
from the original SQLServer 2000 and manually attach them into SQLServer
2005. Also, VS.NET 2005/ .net 2.0 support sqlserver 7.0 2005 (also
include a SQLExpress edition which replace the original MSDE). So please
feel free to use either of them for your data store.

If there're anything unclear or need any further help, please feel free to
post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Thank you Steven,

I never got as far as configuring the datasource correctly.

There was an error executing the (test) query. Please check the syntax of the command and if present, the types and values of the parameters to be sure they are correct.

Invalid name 'Employee'

There is no stack trace. I was in the configuration stage where the wizard asks you to perform a test query.

I went ahead and built default.aspx successfully,

But when I tried to view it in a browser, I got the stack trace you wanted.


Server Error in '/FormatDataList' Application.
--

Invalid object name 'Employee'.
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: Invalid object name 'Employee'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Invalid object name 'Employee'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2300
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
System.Data.SqlClient.SqlDataReader.get_MetaData() +62
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +294
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1021
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +20
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +107
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +10
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +7
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +139
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +140
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1657
System.Web.UI.WebControls.BaseDataList.GetData() +53
System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +267
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +57
System.Web.UI.WebControls.BaseDataList.DataBind() +62
System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +55
System.Web.UI.WebControls.BaseDataList.CreateChildControls() +62
System.Web.UI.Control.EnsureChildControls() +97
System.Web.UI.Control.PreRenderRecursiveInternal() +50
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5729


--
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

dennist685

hank you for the detailed response Dennis,

After tested through your further description, I've reproduce the problem

you encountered. Yes, when using the SqlDataSource's configuration wizard

to generate select statement by "specify columns from a table or view", the

generated SQL statement always cause Error.

And based on my further research, I think this should be a problem of the

SqlDataSource control's configuration wizard. Because for SQL 2005 tables,

they could be grouped by a new unit called "Schema", so when we reference a

table in our SQLStatement , we can not simply use their tablename, but need

to add the schema name together . for example, in our problem, the

Adventureworks database's Employee table are in a schema named

"HumanResources", then, our sql statement should be

"SELECT HumanResources.Employee.* FROM HumanResources.Employee"

or "SELECT * FROM HumanResources.Employee"

rather than "Select * from Employee", "HumanResources" is the schema name.

And seems the SqlDataSource control's

"specify columns from a table or view" wizard dosn't support this

correctly. I'll report this issue to our product team. Curently, I suggest

you try the following means to workaround this problem when dealing with

the SQL2005 database tables:

1. We can manually adjust the sql statement in web page (aspx )'s template

by adding the Schema name before the table name.

2. Instead of using the "specify columns from a table or view" in the

wizard, we can choose another option

"specify a custom SQL statement or stored procedure"

in this wizard, we can use another SQL statement generating tool (Query

Builder ) to auto generate the sql statement (which will correctly add the

Schema name for SQL 2005 data tables based on my tests). Or we can manually

enter sqlstatement also.

Anyway, since this is a problem of our product , I'm sorry for the

inconvenience it brings you. Thanks for your understanding.

Steven Cheng

Microsoft Online Support

Get Secure! www.microsoft.com/security

(This posting is provided "AS IS", with no warranties, and confers no

rights.)

Steven,

thank you every so much for the time you spent tracing down the bug. Frankly, I'm very disappointed in Visual Studio for this and other problems, especially in asp.net 2.0.

Also thank you for solving the problems.

There are also problems I found with other asp.net walkthroughs, but those I found easy ways around.

I find it interesting that the people in Microsoft asp.net forums and Microsoft technical forums couldn't answer the question, and you people, still concentrating of vs 2003, did.

dennist685


|||Thank you Dennis for posting the answer you got; the same problem has been driving me crazy for couple of days. At some point I thought it might be the naming issue but when I got the same error in testing it from the query builder (which I assumed is doing its job right) I did not pursue that direction further.
I don't understand why the common logic was not used - i.e., as long as the name is unque you don't have to qualify it.

Arie|||There's still a problem. The query builder doesn't support WHERE and other clauses. So I guess we have to use the table name and type in the schema qualifier.

It's really disappointing. I don't see how the visual studio team overlooked something so glaring. I imagine in the advanced areas there are bugs galore.

I'd bet SP1 is coming soon.

dennist685