NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 67 68 69 70 71 … 93 Next »
creating a trigger in access .mdb databases?

 
  • 0 Vote(s) - 0 Average
creating a trigger in access .mdb databases?
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#1
2005-10-06, 07:02 AM
anyone if its possible to create a trigger in a ms access .mdb database file?

im trying to make it so when a new music track is added to the database, a couple of triggers are fired before the insert to first make sure an artist exists in the Artist entity and an Album exists in the Album entity, this way i dont have to do mulitple update commands or multiple checks, just the one insert statement, but i keep getting this error when trying to run the create or replace trigger statement
Quote:Syntax error in CREATE TABLE statement.
which is stupid since its not a create table statement..... i thought triggers were in like every db....
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#2
2005-10-06, 09:32 PM
come on anyone every done this? know if its possible?
psycik
Offline

Posting Freak

Posts: 5,210
Threads: 424
Joined: Sep 2005
#3
2005-10-06, 09:41 PM
I thought you could have an auto macro - I knew you used to be able to, I've just looked but not been able to find anything.

They might have just been for opening the database not adding something to the table.

Sorry not much help.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#4
2005-10-06, 09:45 PM
thanks for the input, never really used a macro is all, and a trigger would do exactly what i want, but access doesnt seem to want to create it (and im sure its a standard sql command, and really dont want to have to get people to load mysql or something else).
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,583
Threads: 384
Joined: Dec 2004
#5
2005-10-06, 10:54 PM
Access isn't a 'server' application. Access DBs are just files that you open with ADO/ODBC/whatever providers - you can read/write them, twiddle around with their internals etc. but there's nothing in the background to monitor what's going on.

Triggers and stored procedures are only supported by DB server apps. as far as I can tell.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#6
2005-10-07, 12:09 AM
yeah bugger, i thought access had its on server thing internally, i just presumed it would work fine with (since they're just basic sql commands (insert, update etc) just when another insert etc is done).

anyone know if theres a way to do this in access automatically (not via triggers then), i dont really want to have to write 3 different update statements, or use mysql/oracle etc.
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,583
Threads: 384
Joined: Dec 2004
#7
2005-10-07, 03:31 AM
I can't quite get an angle on what the problem is here as I don't know exactly what you're coding. Using ADO, I'd open recordsets to all of the necessary tables and perform SQL commands against those. If an artist/album already exists you don't have to do anything, if either (or both) don't exist you're going to have to create them anyway at some point, regardless of where the processing is handled.
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#8
2005-10-07, 04:23 AM
i just want to be able to use one sql command to add a music track (ie a music file) to the database, and use a trigger to update the album and artist tables so the artist is added and the album is added (if there arent already there).

it just makes life simplier using one command and leaving it up to the database to ensure consistency.

they way im having to do it now is -
1) read tag info
2) check to see if the artist exists in the artist table
2a) if not add artist
3) check if album exists in album table
3a) if not add album
3b) update artist rating by taking the average of the album ratings for albums by that artist
4) add music track

which is just annoying, with triggers it would just be one sql command.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  NextPVR 5: When is PIN Required for API Access? pkscout 3 2,653 2020-05-26, 04:45 AM
Last Post: sub
  API access to artwork and deleting recordings cncb 29 15,419 2016-11-06, 02:20 AM
Last Post: mvallevand
  Best approach to creating recurring recordings from c# drmargarit 0 2,598 2015-09-27, 01:32 AM
Last Post: drmargarit
  Access 'Stay on top' setting from a plugin? McBainUK 5 2,355 2011-11-07, 04:43 PM
Last Post: sub
  Access ImportHDPVRChannelsForm mvallevand 62 14,350 2011-08-09, 03:37 AM
Last Post: mvallevand
  Creating a Windows service McBainUK 8 3,346 2011-03-30, 03:29 AM
Last Post: mvallevand
  Access to Schedules inside standalone progs dero 1 1,379 2008-12-09, 12:03 PM
Last Post: dero
  Creating a jpg from GetRenderList ACTCMS 8 3,091 2008-09-14, 01:21 AM
Last Post: ACTCMS
  Linking gbpvr.db3 to Access 2003: get readonly tables Khurram 5 3,902 2008-09-11, 08:35 AM
Last Post: Khurram
  Access to FSE switch idkpmiller 12 4,175 2008-07-05, 04:01 PM
Last Post: whurlston

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode