Category Archives: SQL

Easy SQL Insert for Multiple Rows

Here’s a quick and easy way of inserting data. INSERT INTO Beatles (FirstName, Surname) SELECT ‘John’, ‘Lennon’ UNION ALL SELECT ‘Paul’, ‘McCartney’ UNION ALL SELECT ‘George’, ‘Harrison’ UNION ALL SELECT ‘Ringo’, ‘Starr’ GO We start with INSERT INTO and the … Continue reading

Posted in INSERT, SELECT, SQL, UNION | Tagged , , , | Comments Off on Easy SQL Insert for Multiple Rows

Selecting a random database record with SQL

Here’s a “quick and dirty” way of selecting a database record at random. This can be used for things like showing a featured product or a random advert. Continue reading

Posted in ASP.NET, DataRowView, DataView, NEWID(), SQL, TOP, Uncategorized, VB.NET | Tagged , , , , , , , , , | Comments Off on Selecting a random database record with SQL

Confirming delete actions in ASP.NET

When working with databases and the SQL DeleteCommand it may be a good idea to double check that this is what the user intended to do before risking permanently losing data. Continue reading

Posted in ASP.NET, ButtonField, DeleteCommand, GridView, OnClientClick, TemplateField | Tagged , , , , , , , , , | 1 Comment