The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

RE: xPLMediaNet - Need some .net oledb help please


  • Subject: RE: xPLMediaNet - Need some .net oledb help please
  • From: "Keith Doxey" <ukha@xxxxxxxxxxx>
  • Date: Tue, 26 Jul 2005 09:12:02 +0100

> -----Original Message-----
> From: ukha_xpl@xxxxxxx [mailto:ukha_xpl@xxxxxxx]On
> Behalf Of Tony Tofts
>
> I guess the only option is to amend the table and add an autonumber
field,
> but this has implications for compatibility with mysql and mssql I
think?
>

mySQL and MSSQL both have autonumber fields. You simply omit the key field
from the insert statement as the database auto inserts it.

INSERT INTO <table> (FieldOne, FieldTwo) VALUES ('Wibble', 'Wobble')
but
when selecting

SELECT KeyField, FieldOne, FieldTwo FROM myTable WHERE <whatever>
ORDER BY
<something>

Oracle is the only awkward one where you have to create a separate
"Sequence" and then insert Sequence.NextVal into you field you
are using as
a primary key.

INSERT INTO <table> (KeyField, FieldOne, FieldTwo) VALUES
(sequence.NextVal,
'Wibble', 'Wobble')


Another option which should work for any type of database is

INSERT INTO <table> (KeyField, FieldOne, FieldTwo) VALUES
(MAX(KeyField+1),
'Wibble', 'Wobble')

... if the above is total bo****ks in relation to this thread please feel
free to ignore it but it is just general database stuff.

Keith



xPL Links: http://www.xplproject.org.uk http://www.xplhal.com http://www.xpl.myby.co.uk
To Post a Message: ukha_xpl@xxxxxxx
To Subscribe:  ukha_xpl-subscribe@xxxxxxx
To Unsubscribe:  ukha_xpl-unsubscribe@xxxxxxx

xPL Main Index | xPL Thread Index | xPL Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.