Bugged by an easy problem for someone
- From: "Sean" <nospam@xxxxxxxx>
- Date: Sat, 8 Oct 2005 22:04:32 +0100
This should be really easy to answer for someone, but its bugging me as to
whats wrong here. I've summarised the code somewhat for clarity but this is
the important part
sSQL = "SELECT Products.ProdID, Products.Name, DrinkType.Name......<snip>."
Set oData = Server.CreateObject("ADODB.Recordset")
sConString = "dsn=MySQLCon;uid=User;pwd=Pass;"
With oData
.ActiveConnection = sConString
.Source = sSQL
.CursorType = 0
.CursorLocation = 2
.LockType = 1
.Open()
End with
Ok this part of the code is all working fine and returns the recordset
populated with a number of records as expected.
However if use the line :
Response.write(oData.fields("Products.Name").value)
I get the error "ADODB.Recordset (0x800A0CC1) Item cannot be found in the
collection corresponding to the requested name or ordinal"
If I change that line to read :
Response.write(oData.fields(1).value)
The data is written correctly
If I change the SQL statement to sSQL = "SELECT Products.ProdID,
Products.Name AS ProdName......" and use the line:
Response.write(oData.fields("ProdName").value)
The data is written correctly.
Question is why cannot I refer to the field in question useing
oData.fields("Products.Name").value?
TIA
Sean
.
- Follow-Ups:
- Re: Bugged by an easy problem for someone
- From: Might Chaffinch
- Re: Bugged by an easy problem for someone
- From: Stephen Howe
- Re: Bugged by an easy problem for someone
- Prev by Date: How to retrive date field with vb6 code and SQL server 2000
- Next by Date: Re: Converting Command->Execute to Recordset->Open
- Previous by thread: How to retrive date field with vb6 code and SQL server 2000
- Next by thread: Re: Bugged by an easy problem for someone
- Index(es):
Relevant Pages
|
|