Home > front end >  Help!!!!! Why Dreamwaver recordset modify data can only delete the first record,?
Help!!!!! Why Dreamwaver recordset modify data can only delete the first record,?

Time:12-15

 & lt; % @ LANGUAGE="VBSCRIPT" CODEPAGE="65001" % & gt; 
<%
Dim MM_editAction
MM_editAction=CStr (Request. ServerVariables (" SCRIPT_NAME "))
If (Request. The QueryString & lt;> "") Then
MM_editAction=MM_editAction & amp; "?" & Server. The HTMLEncode (Request. The QueryString)
End the If

'a Boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit=false
% & gt;
<%
'* * * Delete Record: construct a SQL Delete statement and execute it

If (CStr (Request (" MM_delete ")="form1" And CStr (Request (" MM_recordId ")) & lt;> "") Then

If (Not MM_abortEdit) Then
'the execute the delete
Set MM_editCmd=Server. CreateObject (" mand "ADODB.Com
MM_editCmd. ActiveConnection=MM_conn_STRING
MM_editCmd.Com mandText="DELETE FROM News WHERE Id=?"
MM_editCmd. The Parameters. Append MM_editCmd. CreateParameter (" param1, 5, 1, 1, Request the Form (" MM_recordId ")) 'adDouble
MM_editCmd. Execute
MM_editCmd. ActiveConnection. Close
End the If

End the If
% & gt;
<%
Dim shanchu__MMColParam
shanchu__MMColParam="1" here change 1 to other number will display the corresponding record
If (Request. The QueryString (scid) & lt;> "") Then
Shanchu__MMColParam=Request. The QueryString (scid)
End the If
% & gt;
<%
Dim shanchu
Dim shanchu_cmd
Dim shanchu_numRows

Set shanchu_cmd=Server. CreateObject (" mand "ADODB.Com
Shanchu_cmd. ActiveConnection=MM_conn_STRING
Shanchu_cmd.Com mandText="SELECT * FROM News WHERE Id=?"
Shanchu_cmd. Prepared=true
Shanchu_cmd. The Parameters. Append shanchu_cmd. CreateParameter (" param1, 5, 1, 1, shanchu__MMColParam) 'adDouble

The Set shanchu=shanchu_cmd. Execute
Shanchu_numRows=0
% & gt;
<%
'* * * you Stats, Move To Record, and Go To Record: declare Stats variables

Dim shanchu_total
Dim shanchu_first
Dim shanchu_last

'set the record count
Shanchu_total=shanchu the RecordCount

'set the number of rows displayed on this page
If (shanchu_numRows & lt; 0) Then
Shanchu_numRows=shanchu_total
Elseif (shanchu_numRows=0) Then
Shanchu_numRows=1
End the If

'set the first and the last displayed record
Shanchu_first=1
Shanchu_last=shanchu_first + shanchu_numRows - 1

'if we have the correct record count, check the other stats
If (shanchu_total & lt;> 1) Then
If (shanchu_first & gt; Then shanchu_total)
Shanchu_first=shanchu_total
End the If
If (shanchu_last & gt; Then shanchu_total)
Shanchu_last=shanchu_total
End the If
If (shanchu_numRows & gt; Then shanchu_total)
Shanchu_numRows=shanchu_total
End the If
End the If
% & gt;
<%
Dim MM_paramName
% & gt;
<%
'* * * Move To Record and Go To Record: declare variables

Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined

Dim MM_param
Dim MM_index

The Set MM_rs=shanchu
MM_rsCount=shanchu_total
MM_size=shanchu_numRows
MM_uniqueCol=""
MM_paramName=""
MM_offset=0
MM_atTotal=false
MM_paramIsDefined=false
If (MM_paramName & lt;> "") Then
MM_paramIsDefined=(Request. The QueryString (MM_paramName) & lt;> "")
End the If
% & gt;
<%
'* * * Move To Record: handle' index 'or' offset 'parameter

If (Not MM_paramIsDefined And MM_rsCount & lt;> 0) then

'use the index parameter if defined, otherwise the use offset parameter
MM_param=Request. The QueryString (" index ")
If (MM_param="") Then
MM_param=Request. The QueryString (" offset ")
End the If
If (MM_param & lt;> "") Then
MM_offset=Int (MM_param)
End the If

'if we have a record count, check if we are past the end of the you
If (MM_rsCount & lt;> 1) Then
If (MM_offset & gt;=MM_rsCount Or MM_offset=1) Then 'past end Or move the last
If ((MM_rsCount Mod MM_size) & gt; 0) Then 'the last page, not a full repeat region
MM_offset=MM_rsCount - (MM_rsCount Mod MM_size)
The Else
MM_offset=MM_rsCount - MM_size
End the If
End the If
End the If

'move the cursor to the selected record
MM_index=0
While (Not MM_rs. (EOF) And (MM_index & lt; MM_offset Or MM_offset=1))
MM_rs. MoveNext
MM_index=MM_index + 1
Wend
If (MM_rs. EOF) Then
MM_offset set MM_offset=MM_index 'to the last possible record
End the If

End the If
% & gt;
<%
'* * * Move To Record: if we dont know the Record count, check the display range

If (MM_rsCount=1) Then

'walk to the end of the display range for this page
MM_index=MM_offset
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull