I am writing some code where i want to get a list of all the company names that start with say, M...
here is what i have:
Dim M_company, companyID_M
Set M_company = adoCon.Execute("SELECT company FROM tbl_exib WHERE company LIKE 'm%'")
companyID_M = M_company( 0 )
but this is only returning the first company in the list that starts with M. Can anybody help with getting it to return more than one value?
thanks,
Leissa1. this is a 'classic' ASP question. this is an ASP.NET forum.
2. that code is doing exactly what I'd expect it to
3. you've neglected to loop through the returned recordset. are you new at this by any chance?|||hmm...yes i am... how'd you guess? :)
so i need to loop something to make it read all the records? any help on how i can do this?|||couple of things :
1. take a decent beginner's tutorial. try www.asp101.com, www.aspin.com, www.4guysfromrolla.com - it'll fill you in on more than a simple forum post.
2. use a classic ASP forum - the ASP.NET snobs here will either ignore your question or tell you you're behind the times (they're wrong, but hey). try www.aspmessageboard.com - you'll usually find me there answering questions.
it's like this
|||Thanks for your help in pointing me in the right direction... :)
While not recordset.EOF
' do stuff here
recordset.moveNext()
Wend
i am using the while not statement like this:
Dim M_company, companyID_M, allRecords
' create a recordset
Set allRecords = Server.CreateObject("ADODB.Recordset")While NOT allRecords.EOF
Set M_company = adoCon.Execute("SELECT company FROM tbl_exib WHERE company LIKE 'm%'")
companyID_M = M_company( 0 )
allRecords.MoveNextWEnd
however i get this error:
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/spiritxmas/displayExhibList_M.asp, line 17
Any quick fix? or should i just start over with the tutorials...
thanks,
Leissa
No comments:
Post a Comment