slivka.com > Code > SQL Summary
Common SQL Statements
INSERT INTO table (field1,field2,...,fieldN) VALUES (value1,value2,...,valueN)
SELECT field1, field2,...,fieldN FROM table WHERE condition
UPDATE table SET field1=value1,field2=value2,...,fieldN=valueN WHERE condition

Condition:


Common ADODB JavaScript Usage
var dsn = 'DSN=GHSF_Members';                       //* Data Source Name
var conn = Server.CreateObject('ADODB.Connection'); //* Connection
conn.Open(dsn);                                     //* Open the connection
var sql = '...';                                    //* An SQL SELECT statement (see above)
var rs = Server.CreateObject('ADODB.RecordSet');    //* The Record Set
rs.MaxRecords = N;                                  //* Only get the first N records
rs.Open(sql,conn);                                  //* Perform the query
if (rs.EOF)                                         //* True when at end of record set 
    //** no records
else {
    nRec = rs.RecordCount;                          //* Count of records (may be expensive to compute?)
    n = rs.fields.count;                            //* Count of fields
    for (i=0; i<n; i++) {
        name = String(rs.fields(i).Name);           //* Get ith field Name
        value = String(rs.fields(i).Value);         //* Get ith field Value
    }
}
rs.Close;                                           //* Close the Record Set
conn.Close();                                       //* Close the Connection

Last updated Saturday, April 19th, 2003.
© 1997-2024 slivka.com. All rights reserved.

Banderooge.com | BenSlivka.com | BenSlivka.net | GarfieldHSF.org | nu1982.org | slivka.org