Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: populating edit and select controls


Message #1 by "microman microman" <microfredo@m...> on Sun, 29 Dec 2002 04:01:15 +0000
Hi,
I am trying to edit and update records from a database. My problem is that Edit and Delete select controls do not get populated. The
page comes up with the controls(adrop down box)
The asp code is
<%  Option Explicit  Dim strConnect  Dim objRS  Dim BookOptions  Dim RSBooks  Dim objconn  Dim adOpenForwardOnly, adLockReadOnly,
adCmdTableadOpenForwardOnly = 0adLockReadOnly = 1adCmdTable = 2If NOT isempty(Request.Form("Edit")) then Response.Redirect
"./edit.asp?ID_Num=" & Request.Form("EditRecordID")   end if   set objconn = server.CreateObject ("adodb.connection")   Set
objRS = Server.CreateObject("ADODB.Recordset")   Dim strDatabaseType'Choose one of the following two lines, and comment out the
other strDatabaseType = "Access"'strDatabaseType = "MSDE"
'Now we use this selection to open the connection in the appropriate wayIf strDatabaseType = "Access" Then  objConn.Open
"Provider=Microsoft.Jet.OLEDB.4.0;" & _               "Data Source=C:\TBDB.mdb;" & _               "Persist Security
Info=False"Else  objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & _               "User ID=sa;Initial
Catalog=Movie;" & _               "Initial File Name=C:\MSSQL7\Data\Movie2000.mdf"End If    objRS.Open "India", objConn,
adOpenForwardOnly, adLockReadOnly, adCmdTable   If NOT isempty(Request.Form("Delete")) then objconn.Execute "delete from India where
In_Num = " & Request.Form ("DeleteRecordID")   end if   set RSBooks = objconn.Execute("select ID_Num,First_Name from India")  
Do Until RSBooks.Eof BookOptions = BookOptions & "<OPTION VALUE=""" & RSBooks("ID_Num")& """>" _     &
RSBooks("First_Name") & "</OPTION>"  RSBooks.MoveNext Loop    %>    
Also the Edit and the Delete Controls say the following:
<SELECT name="EditRecordID"><% Response.Write BookOptions %></SELECT> <INPUT  type=submit value=Edit
name=Edit></P>      <SELECT name="DeleteRecordID"><% Response.Write BookOptions %></SELECT><INPUT
type=submit value=Delete name=delete></P>   
 
Any suggestions would be welcome. Thanks
anjali





The new MSN 8: smart spam protection and  3 months FREE*.  

  Return to Index