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

ASP \ Access Query overwrites Aceess Data

Status
Not open for further replies.

N2PCS

IS-IT--Management
Jul 14, 2003
32
0
0
US
I have the following code:

<%
Dim Conn, RS, strSubmit, strDate, strName

strSubmit = Request(&quot;Submit&quot;)

If strSubmit <> &quot;&quot; Then

Submit = &quot;&quot;
strSubmit = &quot;&quot;

strName = &quot;'&quot; & Request(&quot;Name&quot;) & &quot;'&quot;
strDate = &quot;'&quot; & Request(&quot;Date&quot;) & &quot;'&quot;

' Opens SQL Connection

Set Conn = CreateObject(&quot;ADODB.Connection&quot;)
Conn.Provider = &quot;Microsoft.Jet.OLEDB.4.0&quot;
Conn.Open &quot;\\exchange\requests\TRH IS Request.mdb&quot;

' Creates the select statement
sql = &quot;UPDATE tblScott&quot;
sql = sql & &quot; SET name = &quot; & strName & &quot; and date = &quot; & strDate
response.write sql

' Runs the Query
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open sql, conn, 3, 3


End If
%>
<%
'Cleans up the connection
'Conn.Close
'set rs=nothing
%>

<head>
<title>TRH Support Center</title>
</head>

<body topmargin=&quot;0&quot; leftmargin=&quot;0&quot;>

<form method=&quot;POST&quot; action=&quot;test.asp&quot;>
<p><input type=&quot;text&quot; name=&quot;name&quot; size=&quot;20&quot;></p>
<p><input type=&quot;text&quot; name=&quot;date&quot; size=&quot;20&quot;></p>
<p><input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;Submit&quot;><input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;B2&quot;></p>
</form>

The database opens fine and the data gets wrote to the database. The problem is that it over writes the current row in the table.

Any ideas?
 
Bad Day - I figured it out.
 
&quot;Bad Day - I figured it out.&quot;

Well it doesn't sound TOO bad if you figured it out! :)


Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top