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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The Update Command

Status
Not open for further replies.

spacehawk

Programmer
May 17, 2000
30
US
I am writing a program to take information from teachers who use our Ed. web site. I also want them to be able to update their info when they return.<br><br>I use asp and an access database on an NT4.0 system.<br><br>For putting in new info:<br>Set RS = objConn.Execute(&quot;INSERT INTO Schools ( Name, School, Email) VALUES ('&quot; & NewName & &quot;','&quot; & NewSchool & NewEmail & &quot;')&quot;)<br><br>works great.<br>But when I try to update a record that is already there,<br><br>Set RS = objConn.Execute(&quot;UPDATE Schools ( Name, School, Email) VALUES ('&quot; & NewName & &quot;','&quot; & NewSchool & NewEmail & &quot;') WHERE Email = '&quot; & NewEmail & &quot;'&quot;)<br><br>does not work.&nbsp;&nbsp;Can anyone help me with this syntax?
 
There is a syntax error in update statement. Check it once. it shold be like &quot;update table_name set col_name1=value1,col_name2=value2 where col_name3=value3&quot;<br><br>
 
Thanks.&nbsp;&nbsp;I had figured a way around it by deleting the old record and then inserting the information as a new record, but I would much rather just update it.<br>
 
U could also use this method<br><br><b>sql = &quot;select * from tablename where email = '&quot;& email &&quot; ';&quot;<br>rs.open sql, conn, options1</b><br>Then it would return one row i suppose<br><b><br>rs(&quot;Name&quot;) = Newname<br>rs(&quot;School&quot;) = Newschool<br>rs(&quot;Email&quot;) = Newemail<br>rs.update<br>rs.close</b><br><br>Enjoy! <p>Unicorn11<br><a href=mailto:webmaster@tripmedia.com>webmaster@tripmedia.com</a><br><a href= > </a><br>Hi there it all likeminded fellows!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top