This article mainly introduces the summary of parameters and return values of Asp Conn.execute, and the summary of execute method parameters and return values of database objects. Friends in need can refer to it.
A recent project was to insert excel content into the database. After the insertion, the number of inserted data items had to be displayed. I had been struggling with no solution. Later, after studying execute, I found that this method has return parameters.
Copy the code code as follows:CONN.EXECUTE(SQL,RowsAffected,C)
Parameter meaning:
SQL: The value can be a SQL statement, table name, stored procedure name, or any string acceptable to the data provider. To improve performance.
RowsAffected: The optional parameter will return the number affected after the execution of the INSERT, UPDATE or DELETE query. These queries will return a closed Recordset object. A SELECT query will return a RowsAffected value of -1 and return an open Recordset with one or more rows of content.
C: (Specify SQL statement type)
ADCmdUnknown (= &H0008)
Unknown, it needs to be judged by the system, the speed is slow, it is the default value
ADCmdText (= &H0001)
Command statements such as SQL statements, such as: Select * from Table1
ADCmdTable (= &H0002)
Query table name, for example: Table1
ADCmdStoredProc (= &H0004)
Stored procedure name
ADCmdFile (= &H0100)
The file name corresponding to the object type
ADCmdTableDirect (= &H0200)
is the name of the table that can directly obtain the row content from the table, conn.execute(sql)(0) is the value of the first field of the data set: (specify the SQL statement type)
Usage example:
Copy the code code as follows:conn.EXECUTE update Table1 set Col1='vevb.com',RowsAffected,&H0001
Response.WRITE RowsAffected& rows are affected