Hey all, i am desperately trying to create a nice well structured site using plain old ASP but stuggling with 1 section. I have a class say for example Person, this deals with all person related items like name age etc etc. When i want to add a person to the databse, i create a new object Person and add into that the details, then call a check within that object to check it over, if ok i call another method to write it to the DB. That works great. Now when i want to come to create a list of persons i have tried a similar method using the record set. However, with the record set inside this Person class i cant reference it at all, i just get error messages like. Code: Object doesn't support this property or method: 'RecordCount' or other such "no what do you think you are doing" kinda messages. It works fine if i create the record set inside the page in question, but if it is possible i would like to keep everything person related in person. Anyone got any ideas? Cheers Jon
Ok I knocked up a quick asp class to test this as there should be nothing intrinsically wrong with what you are doing. THese are the possibilities that happened to me as I took off my .NET hat and tried to remember ASP!! Ninety-nine times out of One hundred its because the call for the assignment has not been "set". Are you calling a function to get the records set and forgetting to "set" the return value? viz: Dim objDataSet set objDataSet = myPersonCollection.Item[3].GetDataset() It might also be due to the class scope - did you declare the dataset as "Private"? If so - you'll need to expose the properties of the record set you want to see in your containing class. BTW: In ASP I would certainly not advise having a collection of Datasets unless their disconnected!! let me know if I missed anything or if that helped Stu
Hi there, Cheers for your reply, turns out i think you were right.. I was trying to get the record set returned to me from a public method ala. Code: Public Property Get oRS oRS = s_oRS End Property where s_oRS was private.. The code. Code: dim localoRS set localoRS = tmpStaff.oRS Didnt work.. However, by setting s_oRS to public i can just use Code: dim localoRS set localoRS = tmpStaff.s_oRS and it works I dont know if what i am doing is the best way from a coding point of view, but it seemed logical at quarter to 10 last night Cheers bud Jon
That's the problem then: Public Property Get oRS oRS = s_oRS End Property should be Public Property Get oRS set oRS = s_oRS End Property All variables in ASP are of type VARIANT, objects therefore have to be assigned using the SET operator. Making the recordset public is a very ugly way of doing what you want.