Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Re: [Re: Problem With DataReader]


Message #1 by Imtiaz ALAM <imtiaz_alam@u...> on 22 Nov 00 01:42:18 EST
Thanks Dave,



I ran the script withe the modification in Insert ("Shipping_Methods", in

stead

of "Shipping_Method"). But the error remains the same. i.e.

"Can't find column ShippingMethod. "



While the same connString works perfectly with VB.



Regards

Imtiaz





"Dave Sussman" <davids@i...> wrote:

> This is my fault entirely - I missed out this table from the creation

> scripts. The site should be updated soon with correct code, but in the

> meantime, just paste this into the SQL Query Analyzer Window on the

AdvWorks

> database and hit run. It will create the table and add the rows for you

=2E

> 



> Dave

> 



> CREATE TABLE [dbo].[Shipping_Methods] (

> 



> [ShippingMethodID] [int] NOT NULL ,

> 



> [ShippingMethod] [nvarchar] (20) NOT NULL

> 



> ) ON [PRIMARY]

> 



> GO

> 



> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(1,



> 'Speedy Express')

> 



> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(2,



> 'Federal Shipping')

> 



> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(3,



> 'Mail Company')

> 



> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(4,



> 'Slow Shipping')

> 



> GO

> 



> 



> 



> 



> 



> 



> 



> "Imtiaz ALAM" <imtiaz_alam@u...> wrote in message news:20594@a...



> >

> > I am facing problem with the following ASP+ codes. It says Column

> > ShippingMethod not found. The table and Column exists in the database

=2E I

=3D

> > am

> > using SQL Server 2000 Evaluation Version.

> >

> > This code is from "Preview of ASP+", chapter 2

> >

> >       Dim myCommand As SQLCommand

> >       Dim myReader  As SQLDataReader

> >       Dim SQL       As String

> >       Dim ConnStr   As String

> >

> >       SQl =3D3D "select * from Shipping_Methods"

> >       ConnStr =3D3D

"server=3D3DDotnet\MyDB;uid=3D3Dsa;pwd=3D3D;database=3D3DAdvWor=3D

> > ks"

> >

> >       myCommand =3D3D New SQLCommand(SQL, ConnStr)

> >       myCommand.ActiveConnection.Open()

> >

> >       myCommand.Execute(myReader)

> >

> >       While myReader.Read()

> >         ShipMethod.Items.Add(New

ListItem(myReader.Item("ShippingMethod")=3D

> > , _

> >                                           myReader.Item

> > ("ShippingMethodID")))

> >       End While

> >     End If

> >

> >

> > Regards

> > Imtiaz

> >

> >

> >

> 



> 



> 



Message #2 by Imtiaz ALAM <imtiaz_alam@u...> on 22 Nov 00 01:42:18 EST
Thanks Dave,



I ran the script withe the modification in Insert ("Shipping_Methods", in

stead

of "Shipping_Method"). But the error remains the same. i.e.

"Can't find column ShippingMethod. "



While the same connString works perfectly with VB.



Regards

Imtiaz





"Dave Sussman" <davids@i...> wrote:

> This is my fault entirely - I missed out this table from the creation

> scripts. The site should be updated soon with correct code, but in the

> meantime, just paste this into the SQL Query Analyzer Window on the

AdvWorks

> database and hit run. It will create the table and add the rows for you

=2E

> 



> Dave

> 



> CREATE TABLE [dbo].[Shipping_Methods] (

> 



> [ShippingMethodID] [int] NOT NULL ,

> 



> [ShippingMethod] [nvarchar] (20) NOT NULL

> 



> ) ON [PRIMARY]

> 



> GO

> 



> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(1,



> 'Speedy Express')

> 



> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(2,



> 'Federal Shipping')

> 



> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(3,



> 'Mail Company')

> 



> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(4,



> 'Slow Shipping')

> 



> GO

> 



> 



> 



> 



> 



> 



> 



> "Imtiaz ALAM" <imtiaz_alam@u...> wrote in message news:20594@a...



> >

> > I am facing problem with the following ASP+ codes. It says Column

> > ShippingMethod not found. The table and Column exists in the database

=2E I

=3D

> > am

> > using SQL Server 2000 Evaluation Version.

> >

> > This code is from "Preview of ASP+", chapter 2

> >

> >       Dim myCommand As SQLCommand

> >       Dim myReader  As SQLDataReader

> >       Dim SQL       As String

> >       Dim ConnStr   As String

> >

> >       SQl =3D3D "select * from Shipping_Methods"

> >       ConnStr =3D3D

"server=3D3DDotnet\MyDB;uid=3D3Dsa;pwd=3D3D;database=3D3DAdvWor=3D

> > ks"

> >

> >       myCommand =3D3D New SQLCommand(SQL, ConnStr)

> >       myCommand.ActiveConnection.Open()

> >

> >       myCommand.Execute(myReader)

> >

> >       While myReader.Read()

> >         ShipMethod.Items.Add(New

ListItem(myReader.Item("ShippingMethod")=3D

> > , _

> >                                           myReader.Item

> > ("ShippingMethodID")))

> >       End While

> >     End If

> >

> >

> > Regards

> > Imtiaz

> >

> >

> >

> 



> 



> 



> ---

> Wrox Professional Web Developer Conference II

> http://www.wroxconferences.com/WebDevEurope

> November 29th - December 1st 2000, Amsterdam, Netherlands

> Create powerful distributed web applications serving you now and

> in the future. From ASP+ and VB.NET to XML and SQL Server 2000








____________________________________________________________________

Get free email and a permanent address at http://www.netaddress.com/?N=3D

1

Message #3 by "Jacques Leclerc" <jleclerc2@h...> on Wed, 22 Nov 2000 09:22:39 -0500
I typed in the code from the book and ran into the same problem. There is a

difference between the downloaded code and that in the book. One uses the

ADO version instead of the SQL version of the call. The problem I had was

trying to access the SQL db using the ADO functions. When I switched to the

SQL functions everything work as it should.



Jacques

jacques_leclerc@h...



"Imtiaz ALAM" <imtiaz_alam@u...> wrote in message news:20789@a...



Thanks Dave,



I ran the script withe the modification in Insert ("Shipping_Methods",

instead

of "Shipping_Method"). But the error remains the same. i.e.

"Can't find column ShippingMethod. "



While the same connString works perfectly with VB.



Regards

Imtiaz





"Dave Sussman" <davids@i...> wrote:

> This is my fault entirely - I missed out this table from the creation

> scripts. The site should be updated soon with correct code, but in the

> meantime, just paste this into the SQL Query Analyzer Window on the

AdvWorks

> database and hit run. It will create the table and add the rows for you.

>

> Dave

>

> CREATE TABLE [dbo].[Shipping_Methods] (

>

> [ShippingMethodID] [int] NOT NULL ,

>

> [ShippingMethod] [nvarchar] (20) NOT NULL

>

> ) ON [PRIMARY]

>

> GO

>

> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(1,

> 'Speedy Express')

>

> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(2,

> 'Federal Shipping')

>

> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(3,

> 'Mail Company')

>

> INSERT INTO Shipping_Method(ShippingMethodID, ShippingMethod) VALUES(4,

> 'Slow Shipping')

>

> GO

>

>

>

>

>

>

>

> "Imtiaz ALAM" <imtiaz_alam@u...> wrote in message news:20594@a...

> >

> > I am facing problem with the following ASP+ codes. It says Column

> > ShippingMethod not found. The table and Column exists in the database. I



> > am

> > using SQL Server 2000 Evaluation Version.

> >

> > This code is from "Preview of ASP+", chapter 2

> >

> >       Dim myCommand As SQLCommand

> >       Dim myReader  As SQLDataReader

> >       Dim SQL       As String

> >       Dim ConnStr   As String

> >

> >       SQl =3D "select * from Shipping_Methods"

> >       ConnStr =3D

"server=3DDotnet\MyDB;uid=3Dsa;pwd=3D;database=3DAdvWor

> > ks"

> >

> >       myCommand =3D New SQLCommand(SQL, ConnStr)

> >       myCommand.ActiveConnection.Open()

> >

> >       myCommand.Execute(myReader)

> >

> >       While myReader.Read()

> >         ShipMethod.Items.Add(New

ListItem(myReader.Item("ShippingMethod")

> > , _

> >                                           myReader.Item

> > ("ShippingMethodID")))

> >       End While

> >     End If

> >

> >

> > Regards

> > Imtiaz

> >

> >

> >

>

>

>


  Return to Index