The technical small problem found in the recent study!

xiaoxiao2021-03-05  22

I was ready to try the courses developed in a computer college a few days ago, I wanted for a while, I don't know what to say. Personally feel that most of the use of Web is multi-interactive inquiry. So I think it is best to talk about the content of the database. Because it can be said that this is a basic entry point for many problems. In the process of checking the information, I saw one of the articles on VBScript and Jscript, there are some new understandings for the database connection. (Anyway, I am discovering, learning, then, I will find what is small) "How to use VBScript and JScript to create a discontinuous ADO recordset in ASP" Note: 1, http://support.microsoft. COM / DEFAULT.ASPX? SCID = KB; ZH-CN; 289531 # Appliesto 2, Microsoft Knowledge Base Article - 289531 The full text is this article introduces one for programming when using Microsoft Vbscript and Microsoft Jscript, in Active Creating an ActiveX Data Object (ADO) Non-Connection Recorder in Server Page (ASP). This article assumes that the reader is familiar with ADO and ASP. One of the principles of ASP is to release the ADO object as soon as possible to release the system resources used by these objects. ADO Non-Connection Record Set This feature allows record sets to exist when there is no active connection; this saves database server resources and increases scalability. ADO Non-Connection Record Sets Using Client Cursors, this can be implemented by setting the CursorLocation property of the Connection object to AduseClient. The following sample code uses Microsoft OLEDB Provider for SQL Server (SQLOLEDB) to the Northwind sample database that is provided with the SQL Server installation. To run these examples, you need to modify the connection string and the SELECT statement to accommodate your environment. In addition, you have to set the correct path to the include file of the ADO constant. Non-connection record set in VBScript <% @ language = "VBScript"%>

<% 'Connection string strCon =. "Provider = sqloledb; Data Source = myServer; Initial Catalog = Northwind; User Id = myUser; Password = myPassword"' Create the required ADO objects Set conn = Server.CreateObject ( "ADODB.Connection. ") Set rs = Server.CreateObject (" ADODB.recordset ") 'Open the connection. conn.Open strCon' Retrieve some records. strSQL =" Select * from Shippers "rs.CursorLocation = adUseClient rs.Open strSQL, conn, adOpenStatic , adLockOptimistic 'Disconnect the recordset. Set rs.ActiveConnection = Nothing' Release the connection. conn.Close 'Check the status of the connection. Response.Write ( "Connection.State =" & conn.State) Set conn = Nothing' Use The Diconnected Recordset Here. 'Release The RecordSet. rs.close set = Nothing%> Note that the recordset is connected to Nothing by setting the ActiveConnection property to Nothing. Non-connection record set in JScript <% @ language = "jscript"%>

<% // Connection string var strCon =. "Provider = sqloledb; Data Source = myServer; Initial Catalog = Northwind; User Id = myUser; Password = myPassword"; // Create the required ADO objects conn = Server.CreateObject ( ". AdoDb.connection "); RS = Server.createObject (" AdoDb.Recordset "); // Open the connection. Conn.open (STRCON); // Retrieve Some Records. Var strsql =" select * from shippers "; RS. CursorLocation = adUseClient; rs.Open (strSQL, conn, adOpenStatic, adLockOptimistic); // Disconnect the recordset DisconnectRecordset (rs);. // Release the connection conn.Close ();.. // Check the status of the connection Response .Write.

Connection.State = " conn.state); conn = null; // use the diconnected recordset here. Rs.close (); rs = null;%>