Forums
This topic is locked
Update from repeat region
Posted 30 Jun 2004 12:04:44
1
has voted
30 Jun 2004 12:04:44 Wayne Hultum posted:
Hi all,I'm buliding a site in ASP with an Access DB.
What I'm wanting to do is update the DB from a list created from a repeat region.
The repeat region is a list of cars with a radion button next to it. What I want to do is click on the radio button to make the car a "star car" to be displayed on the front page of the site.
I am getting to the list page through the main menu and it not passing any values to the repeat region (list) page.
When I try and update i get the following error
Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/cars/carStar.asp, line 280
I thinks it's to do with not passing anything to the repeat region page. Is there a way i can get from the main navigation to the repeat region page so I can update the DB,
Hope someone can help
Thanks in advance
Wayne
Replies
Replied 30 Jun 2004 12:15:33
30 Jun 2004 12:15:33 Simon Martin replied:
I think what you need to do is bind the car ID to the radio button - so that when you select it the cars id value is included in your update statement.
Because its in the repeat region each radio button will have a unique id value.
Sharing knowledge saves valuable time!
Simon
Because its in the repeat region each radio button will have a unique id value.
Sharing knowledge saves valuable time!
Simon
Replied 30 Jun 2004 13:50:56
30 Jun 2004 13:50:56 Wayne Hultum replied:
Thanks Simon,
I've had a go at binding the ID to the radio button but i still get the error.
I've nerver tried the binding before so i don't know if I've done it properly. I selected the radio button and clicked bind in the bindings tab.
regards
Wayne
I've had a go at binding the ID to the radio button but i still get the error.
I've nerver tried the binding before so i don't know if I've done it properly. I selected the radio button and clicked bind in the bindings tab.
regards
Wayne
Replied 30 Jun 2004 14:08:07
30 Jun 2004 14:08:07 Dave Thomas replied:
hey wayne,
try when your adding your link, there is a parameters button, this can be used to add query string info to the link etc..
if you need to pass info to a link with no other option then this is the way to do it.
Regards,
Dave
[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]
try when your adding your link, there is a parameters button, this can be used to add query string info to the link etc..
if you need to pass info to a link with no other option then this is the way to do it.
Regards,
Dave
[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]
Replied 30 Jun 2004 18:47:43
30 Jun 2004 18:47:43 Wayne Hultum replied:
Thanks,
But still no joy <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
But still no joy <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
Replied 30 Jun 2004 18:56:14
30 Jun 2004 18:56:14 Dave Thomas replied:
hows the db set up? do you have a field for 'starcar' with a default value of 'no'. ?
radio button might be a bad choice, try a checkbox instead as it will give you the boolean value you require. and bind the id to it.
im gonna build a simple table in a db and test it, it should be well doable, it's virtually exactly the same procedure as multiple delete except your updating instead.
Regards,
Dave
[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]
radio button might be a bad choice, try a checkbox instead as it will give you the boolean value you require. and bind the id to it.
im gonna build a simple table in a db and test it, it should be well doable, it's virtually exactly the same procedure as multiple delete except your updating instead.
Regards,
Dave
[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]
Replied 30 Jun 2004 19:22:52
30 Jun 2004 19:22:52 Wayne Hultum replied:
I have a field in the DB for the star car, by default it is unticked, when one it ticked that becomes the star car.
So when I change the star car it needs to untick the current star car and tick the new star car.
regards
Wayne
So when I change the star car it needs to untick the current star car and tick the new star car.
regards
Wayne
Replied 30 Jun 2004 19:51:31
30 Jun 2004 19:51:31 Dave Thomas replied:
doh
heres me trying to do a multiple star car update <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
i didnt realise it just for the one car.
Regards,
Dave
[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]
heres me trying to do a multiple star car update <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
i didnt realise it just for the one car.
Regards,
Dave
[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]
Replied 01 Jul 2004 12:56:38
01 Jul 2004 12:56:38 Wayne Hultum replied:
I was trying to update via the server behaviors>update record when I'm getting the error.
What I want to try now is update the DB via the command>update but I don't know how to do this.
The radio button that will update the DB is called "radiobutton" and the field in the DB is called car_star.
if you require any more info just let me know and I'll post it.
If you could give me some help with this it would be appreciated.
regards
Wayne
What I want to try now is update the DB via the command>update but I don't know how to do this.
The radio button that will update the DB is called "radiobutton" and the field in the DB is called car_star.
if you require any more info just let me know and I'll post it.
If you could give me some help with this it would be appreciated.
regards
Wayne
Replied 01 Jul 2004 15:52:20
01 Jul 2004 15:52:20 Simon Martin replied:
I think, from the sounds of it, that you might be advised to set up a new table tblStarCar with the ID of the car, date and any other relevant fields (expiry date etc)
So when you select which car you want to be the 'Star Car' from your global selection it creates a new record.
You could just use a conditional IF to highlight which car is currently the star car and just make a text link to select the new one.
This way you'll have an historical record of which cars have been stars and you wont need to flag and unflag lots of cars in the tblCars on Update.
Unless you want to have many star cars at once - and use a random selection from them for the front page. In which case you I would suggest the checkbox method from ultradav
Sharing knowledge saves valuable time!
Simon
So when you select which car you want to be the 'Star Car' from your global selection it creates a new record.
You could just use a conditional IF to highlight which car is currently the star car and just make a text link to select the new one.
This way you'll have an historical record of which cars have been stars and you wont need to flag and unflag lots of cars in the tblCars on Update.
Unless you want to have many star cars at once - and use a random selection from them for the front page. In which case you I would suggest the checkbox method from ultradav
Sharing knowledge saves valuable time!
Simon
Replied 01 Jul 2004 16:23:04
01 Jul 2004 16:23:04 Wayne Hultum replied:
Hi Simon
Is this what you mean, I don't quite understand what you are getting at.
I should create a new table to hold the star car info with all the same fields as the main car table.
On the car list have a link that inserts all the data from the main table in the star car table.
Reagrds
wayne
Is this what you mean, I don't quite understand what you are getting at.
I should create a new table to hold the star car info with all the same fields as the main car table.
On the car list have a link that inserts all the data from the main table in the star car table.
Reagrds
wayne
Replied 01 Jul 2004 16:35:05
01 Jul 2004 16:35:05 Simon Martin replied:
From what i understand you want to select one car and make it the star car and display that car on the front page?
If there is only ever 1 star car at any time, then I would make a table to record that - you would only need the carID and maybe the date it was created (so you could create your recordset and select only the most recent)
Then you could populate the front page with that car. When you next change the star car you would create a new record with a more recent date. You could bring up historical records of which cars had been stars - and use that information to 'sell' the idea of star cars to someone else... e.g. star cars are 5 times more likely to be sold than non-star cars
On the other hand if you want to have a selection of star cars you would need to create a 'random' car which you could do with a dynamic cursor.
Sharing knowledge saves valuable time!
Simon
If there is only ever 1 star car at any time, then I would make a table to record that - you would only need the carID and maybe the date it was created (so you could create your recordset and select only the most recent)
Then you could populate the front page with that car. When you next change the star car you would create a new record with a more recent date. You could bring up historical records of which cars had been stars - and use that information to 'sell' the idea of star cars to someone else... e.g. star cars are 5 times more likely to be sold than non-star cars
On the other hand if you want to have a selection of star cars you would need to create a 'random' car which you could do with a dynamic cursor.
Sharing knowledge saves valuable time!
Simon
Replied 01 Jul 2004 16:41:31
01 Jul 2004 16:41:31 Simon Martin replied:
if you have a table for cars and a field for starcar in all records and you only want 1 car to be the star car then you will have a lot of NULL's.
Also you would need to update the record for the new star car and set the value for the old star car to not_star_car.
Access doesnt use Stored procedures - which would make that relatively easy to do, but on update you would need to select the ID of the current star car and set starcar = 0, then run your update to set the new starcar.
Sharing knowledge saves valuable time!
Simon
Also you would need to update the record for the new star car and set the value for the old star car to not_star_car.
Access doesnt use Stored procedures - which would make that relatively easy to do, but on update you would need to select the ID of the current star car and set starcar = 0, then run your update to set the new starcar.
Sharing knowledge saves valuable time!
Simon
Replied 01 Jul 2004 17:23:30
01 Jul 2004 17:23:30 Wayne Hultum replied:
Would I use insert via the server behaviors>insert record or the command>insert to get the ID of the car from the main list to the star car table?
regards
Wayne
regards
Wayne
Replied 01 Jul 2004 18:51:32
01 Jul 2004 18:51:32 Simon Martin replied:
Yeah a standard insert behaviour.
On each car you would have a text link / button or whatever with the car ID bound to it, then when you submit the form it creates a new record in the starcar table and uses getdate() to give it the current date.
Sharing knowledge saves valuable time!
Simon
On each car you would have a text link / button or whatever with the car ID bound to it, then when you submit the form it creates a new record in the starcar table and uses getdate() to give it the current date.
Sharing knowledge saves valuable time!
Simon
Replied 01 Jul 2004 19:04:42
01 Jul 2004 19:04:42 Wayne Hultum replied:
Thanks for all the help.
I'll give it a go tomorrow.
regards
Wayne
I'll give it a go tomorrow.
regards
Wayne