Recommended: ASP 3.0 Advanced Programming (39) 8.4.3 It is very easy to create a record set. It is implemented by calling the Open method of the Recordset object: Recordset.Open [Source], [ActiveConnection], [CursorType], [LockType], [Options] The parameters and descriptions are as shown in Table 8-
For beginners who use ASP technology to program, it is their first feeling that they have no idea how to start. The author once had such an experience. After some hardships, you will find inspiration. Now I will devote some of the experience I have accumulated in programming to readers.
1 First, you need to learn some example programs.
After receiving the task, don't blindly rush to write the code, but first look at other people's successful examples, and then modify or imitate debugging on it, which will speed up the familiar speed. For example, there is often an example in textbooks about ASP programming, that is, a statement that shows the current time of the system: <%=now()%>. Although such a simple statement contains ASP's programming ideas and formats, it will be of great help to your subsequent work. For example, to test whether the WEB SERVER of IIS (Internet Information Server) is working normally, it is enough to use the above statement to test.
2 After installing ODBC on WINDOWS NT, you need to test that the background database is indeed connected, and then start programming testing.
Maybe you don't understand the meaning of the question. I will explain it here: For example, the background database is ORACLE. Then on NT SEVER, you must first install SQL*NET (or NET 8), then configure ODBC to confirm that it is connected to the ORACLE database. You can use SQL*PLUS to test, and also select the same character set as the ORACLE database. This work must be completed in the registry. Finally, after the test and the ORACLE database are connected in ODBC, it is stated that the work of WEB SERVER to the backend database is completed, and the programming work will begin. On the other hand, if you program first and then do ODBC work, then you cannot debug whether the program is correct, which may greatly reduce the programming efficiency. In the ODBC configuration, you should select MICROSOFT ODBC FOR ORACLE. Do not select ORACLE ODBC DRIVER, otherwise you will not be able to establish contact with the database.
In ASP programs, the statements connected to the database are relatively fixed, for example:
Set Conn = Server.CreateObject(ADODB.Connection)
Conn.Open odbclink,o7people,peoplepd
Here, odbclink is the name of the data source, which can be said to be the definition of ODBC and database connection, o7people is a user name of ORACLE, and peoplepd is the password of the user o7people.
3 Record the error information and find the error correction rules.
During the programming and debugging process, it is a cycle of errors and corrections, but over time, some rules will be found, and the efficiency of eliminating errors will be greatly improved.
3.1 Error message:
Microsoft OLE DB Provider for ODBC Drivers Error '80040e14'
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00933: SQL command not properly ended
/default.asp, line 781
This error is usually caused by the problem with the defined SQL statement when executing the Conn.Execute (SQL statement). Checking this statement will reveal the problem, such as the date format is incorrect, etc.
zhezhong
3.2 Error message:
ADODB.Field Error '800a0bcd'
One of the BOF or EOF is true, or the current record has been deleted, but the application requires that the current record be operated.
/lzjsblr.asp, line 123
This error usually occurs during the execution of the following statements:
set RS = Conn.Execute(SQL statement)
varnum1=RS(0)
RS.CLOSE
The value RS(0) is meaningless or meaningless, and the correctness of the SQL statement must also be checked.
3.3 Error message:
Microsoft VBScript compiler error Error '800a0409'
Unfinished string constants
/people/default.asp, line 86
insert_sql = insert_sql & dwdm & ,' & d1 & ',' & t1 & ',' & t2 & ',
--------------------------------------------------------------------------^
The secondary error also occurs in the definition of SQL statements, checking the pairing of quotes, single quotes, etc.
4 Below is a browser-based online user registration program. The author has used some skills to dedicate it to interested readers.
<html>
<head>
...
<
<%' and database connection
Set Conn = Server.CreateObject(ADODB.Connection)
Conn.Open odbclink,o7people,peoplepd
'Put selected data into the selection box
Set RS = Conn.Execute(SELECT dwmc FROM tab_dw order by dwdm)
%>
<% Do While Not RS.EOF %> <option><% = RS(0) %></option>
<%
RS.MoveNext
Loop
RS.Close
%>
<%
'Define variables
Dim D1, D2, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, csrq, sqrq
'Event Trigger Button
B1=commit
B2=return
%>
<%
'Initialize the information
Sub Reset()
D1 =
...
T9 = date()
T10 =
End Sub
%>
<%
Call Reset()
%>
<%
'Information submission condition (trigger condition)
if Request(B1) = commit Then 'Save Button
D1 = Request(D1)
set DWDM_RS = Conn.Execute(SELECT dwdm FROM table_dw where dwmc='&D1&' )
DWDM=DWDM_RS(0)
DWDM_RS.CLOSE
D2 = Request(D2)
...
'Date data is converted into ORACLE-recognized format
csrq = DAY(T6) & - & month_array(Month(T6)) & - & Year(T6)
sqrq = DAY(T9) & - & month_array(Month(T9)) & - & Year(T9)
'Define SQL statement
Sql_insert = INSERT INTO peopleuser(dwdm,dwmc,sjks,tele,address,zipcode,xm,xb,csrq,peoplename,peoplepd,sqsj,bz) VALUES ('
Sql_insert = Sql_insert & DWDM & ',' & D1 & ',' & T1 & ',' & T2 & ',' & T3 & ',' & T4 & ','
Sql_insert = Sql_insert &T5&','& D2 & ',' & CSRQ & ',' & T7 & ',' & T8 & ',' & SQRQ & ','
Sql_insert = Sql_insert & T10 & ')
'Installation of information
Set LFMC_R4 = Conn.Execute(Sql_insert)
'After the information is submitted, initialize the screen information
call reset()
end if
%>
Share: In ASP, it is implemented to export data from dbf database to sql table Description: The dbf database structure must be consistent with the sql table. The following is the reference content: <% Dim conndbf_dbf, Driver_dbf, SourceType_dbf, DBPath_dbf dim Conn_