Forums

This topic is locked

Problem getting one record to insert to 2nd Table

Posted 04 Nov 2002 15:13:21
1
has voted
04 Nov 2002 15:13:21 Perry Olsen posted:
Sorry if this becomes a mess but here we go....

I have a stored procedure that States.
"INSERT INTO dbo.NFFLPlayerNew

Select *
From dbo.NFFLPlayers"

I have two dynamic list/menus that display the record sets of the tables that I want to affect. I have a button in the middle of it all.

When I start this in the web page it shows both lists correctly but when I press the button it move the entire record set from NFFLPlayers to NFFLPlayerNew. I want it to move only one record that is selected in the recordset and not the entire recordset.

Can any one help???????

Here is the code

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/FFBL.asp" -->
<%
set rsPlayer1 = Server.CreateObject("ADODB.Recordset"
rsPlayer1.ActiveConnection = MM_FFBL_STRING
rsPlayer1.Source = "SELECT * FROM dbo.NFFLPlayers"
rsPlayer1.CursorType = 0
rsPlayer1.CursorLocation = 2
rsPlayer1.LockType = 3
rsPlayer1.Open()
rsPlayer1_numRows = 0
%>
<%
set rsPlayer2 = Server.CreateObject("ADODB.Recordset"
rsPlayer2.ActiveConnection = MM_FFBL_STRING
rsPlayer2.Source = "SELECT * FROM dbo.NFFLPlayers"
rsPlayer2.CursorType = 0
rsPlayer2.CursorLocation = 2
rsPlayer2.LockType = 3
rsPlayer2.Open()
rsPlayer2_numRows = 0
%>
<%

set cmdPlayerList = Server.CreateObject("ADODB.Command"
cmdPlayerList.ActiveConnection = MM_FFBL_STRING
cmdPlayerList.CommandText = "dbo.PlayerInsertNew"
cmdPlayerList.Parameters.Append cmdPlayerList.CreateParameter("@RETURN_VALUE", 3, 4)
cmdPlayerList.CommandType = 4
cmdPlayerList.CommandTimeout = 0
cmdPlayerList.Prepared = true
cmdPlayerList.Execute()

%>
<%

set cmdPlayerInsert = Server.CreateObject("ADODB.Command"
cmdPlayerInsert.ActiveConnection = MM_FFBL_STRING
cmdPlayerInsert.CommandText = "dbo.PlayerInsertNew"
cmdPlayerInsert.Parameters.Append cmdPlayerInsert.CreateParameter("@RETURN_VALUE", 3, 4)
cmdPlayerInsert.CommandType = 4
cmdPlayerInsert.CommandTimeout = 0
cmdPlayerInsert.Prepared = false

%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<form name="form1">
<select name="select" size="20" onClick="@Player">
<%
While (NOT rsPlayer1.EOF)
%>
<option value="<%=(rsPlayer1.Fields.Item("Player".Value)%>" ><%=(rsPlayer1.Fields.Item("Player".Value)%></option>
<%
rsPlayer1.MoveNext()
Wend
If (rsPlayer1.CursorType > 0) Then
rsPlayer1.MoveFirst
Else
rsPlayer1.Requery
End If
%>
</select>
<input type="submit" name="Submit">
<select name="select2" size="20">
<%
While (NOT rsPlayer2.EOF)
%>
<option value="<%=(rsPlayer2.Fields.Item("Player".Value)%>" ><%=(rsPlayer2.Fields.Item("Player".Value)%></option>
<%
rsPlayer2.MoveNext()
Wend
If (rsPlayer2.CursorType > 0) Then
rsPlayer2.MoveFirst
Else
rsPlayer2.Requery
End If
%>
</select>
</form>
<p> </p>
</body>
</html>
<%
rsPlayer1.Close()
%>
<%
rsPlayer2.Close()
%>

Reply to this topic