Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello, can anyone please check whet

Status
Not open for further replies.

Goog

MIS
Mar 12, 2002
6
US
Hello, can anyone please check whether the following code is correct? It seem to be that it is not working.


<%

if (Request.Form (&quot;submit&quot;) <> &quot;&quot;) Then

Dim adoCon, adoRec ' ADO connection object
Dim ConnString
Dim myNameID, myUserID, myPwd, myDept, myYr, myEmail, sql

myNameID = Request.Form (&quot;text1&quot;)
myUserID = Request.Form (&quot;text2&quot;)
myPwd = Request.Form (&quot;password1&quot;)
myDept = Request.Form (&quot;select1&quot;)
myYr = Request.Form (&quot;select10&quot;)
myEmail= Request.Form (&quot;text3&quot;)


Set adoCon = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set adoRec=server.CreateObject (&quot;ADODB.Recordset&quot;)
ConnString=&quot;driver={sql server};server=Mell; database=portal;DSN=localserver;PWD=;UID=sa;&quot;
adoCon.Open ConnString

adoRec.ActiveConnection = adoCon

sql= &quot; UPDATE info &quot; & _
&quot;SET NameID='&quot; & myNameID & &quot;', &quot; & _
&quot;UserID='&quot; & myUserID & &quot;', &quot; & _
&quot;password='&quot; & myPwd & &quot;', &quot; & _
&quot;yearinfo='&quot; & myYr & &quot;', &quot; & _
&quot;email='&quot; & myEmail & &quot;', &quot; & _
&quot;WHERE department='&quot; & myDept & &quot;'&quot;

adoCon.Execute (sql)

Response.Redirect (&quot;Continue&quot;)

else%>
<script>
window.alert(&quot;Records cannot be updated&quot;);
</script>
<%End if

adoCon.Close
Set adoCon = Nothing

%>


thank You!! :-V
 
Hi

Try changing the UPDATE to INSERT INTOin the SQL statement. You are trying to update without have a record in the DB to update from what I see.

hth

Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top