Announcement

Collapse
No announcement yet.

Database Function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Database Function

    Hi Hi,

    I have started to move some of my scripts to functions for ease of programming, since it seems to make it easier both to determine where errors exist, but also allows me to reuse the functions in other scripts thus speeding up my programming requirements.

    I have moved a File writer to function (which i admit is probably overkill), I have alot of regex moved across to functions as well, with many different regex's extracting and returning a fair amount of information.

    However now i want to start using the information more effectively, and to do this i need to start to put it in a database.

    I do have database scripts, however I am wondering if anyone has a database function they use in their scripts. I wonder if it is even really feasible to put a database (insert) component in a function?

    Just curious how people most efficiently work around databases, or is it just a case of having lots of insert, update, or delete sections in your scripts where-ever they may be required.

    My thought was a function could be done along the lines of:

    Public Function Write2DB(DatabaseFile as String, TableName as String, FieldstoInsertInto as String, ValuestoInsert as String)

    Then have it so that if you wanted to insert into a table multiple entries you might just seperate them by |, so for example Write2DB("ExampleDB.mdb","Example_Table","Field1|Field2|Fiel d3|Field3","1|abcde|10:59|2|b")

    Thanks
    HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

    Facebook | Twitter | Flickr | Google+ | Website | YouTube

    #2
    Providing the database schema stays the same then there is probably not a great amount to be gained. If you are anticipating changes to table structure then yeah it is going to be easier to only edit a single SQL command rather than 10.

    Comment

    Working...
    X