PDA

View Full Version : How to update record in database using ASP and Flash


hasliza
10-14-2005, 09:15 AM
Hi...

Can you help me....

this is my updateproject.asp coding:

<html>
<head>
<title>SOFTEAC SDN BHD </title>
</head>

<body>
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="config.inc"-->
<%
strEmail = Request.Form("txtemail")
strProjectProgress = Request.Form ("txtprojectprogress")
strProjectInCharge = Request.Form ("txtprojectincharge")
strProjectComment = Request.Form ("txtprojectcomment")
strProjectUpdate = Request.Form ("txtprojectupdate")

Dim Message1
If strProjectProgress = "" Then
Message1="Please give a new progress of this project!<br>"
Response.Write(Message1)
End If

Dim Message2
If strProjectInCharge = "" Then
Message2="Please give a new name of the person in charge!<br>"
Response.Write(Message2)
End If

Dim Message3
If strProjectComment = "" Then
Message3="Please give a comment of this project!<br>"
Response.Write(Message3)
End If

Dim Message4
If strProjectUpdate = "" Then
Message4="Please give an updated date!<br>"
Response.Write(Message4)
End If

Dim myRS
Set myRS = Server.CreateObject("ADODB.Recordset")
If myRS.EOF Then
SQL = "SELECT * FROM PROJECT WHERE REG_EMAIL='"& strEmail &"'"
myRS.CursorType = 2
myRS.LockType = 3
myRS.Open SQL, conn

myRS("PROJECT_PROGRESS") = Request.Form("txtprojectprogress")
myRS("PROJECT_INCHARGE") = Request.Form("txtprojectincharge")
myRS("PROJECT_COMMENT") = Request.Form("txtprojectcomment")
myRS("PROJECT_UPDATE") = Request.Form("txtprojectupdate")

myRS.Update
Dim mainMessage
mainMessage="The project was updated by '"& strProjectInCharge & "'.<br>"

Else
If(strEmail = Request.Form("txtemail") AND strProjectName = Request.Form("txtprojectname")) Then
mainMessage="The project was updated before by '"& strProjectInCharge & "'!<br>"
End If
End If

myRS.Close
Set myRS=Nothing
conn.Close
Set conn=Nothing

Response.Write(mainMessage)
%>
</body>
</html>


and this is my update button in Actionscript:

on(press)
{getURL("updateproject.asp",0,"POST");}


I have an error on :
Source line: If myRS.EOF Then
Description: Operation is not allowed when the object is closed.

can you help me to solve this problem.

Anyway Thanks so much.....:)

JGS
10-14-2005, 11:46 AM
I think you're trying to read de RS before open it. Must place the 'If myRS.EOF Then' line after 'myRS.Open SQL, conn'

Dim myRS
Set myRS = Server.CreateObject("ADODB.Recordset")
If myRS.EOF Then
SQL = "SELECT * FROM PROJECT WHERE REG_EMAIL='"& strEmail &"'"
myRS.CursorType = 2
myRS.LockType = 3
myRS.Open SQL, conn