Hey everyone,
I wrote this code in order to add a couple of input boxes worth of values to aan Access DB stored on the domain. There are no errors and the the code seems to input and transfer values into the DB properly but it will not add it as a new record. It just keeps overwriting the old one. What am I missing? Please, any help would be greatly appreciated.
Code:<%@ LANGUAGE=VBSCRIPT ENABLESESSIONSTATE=TRUE %> <% if Session("goodlogon") = "False" then response.redirect "nogood.asp" end if Set dataConn = Server.CreateObject("ADODB.Connection") dataConn.ConnectionString="DSN=Coopersburg" dataConn.Mode = adModeReadWrite dataConn.Open set dataCmd = Server.CreateObject("ADODB.Command") dataCmd.ActiveConnection = Session("dataConn") Function StripQuotes(strStrip) 'Strips all single quotes from strStrip & returns cleaned string For i = 1 To Len(strStrip) If Mid(strStrip, i, 1) = "'" Then strStrip = Left(strStrip, i - 1) & Right(strStrip, Len(strStrip) - i) End If Next StripQuotes = strStrip End Function if Request.Form("cmdSave") = "Save" then ProdName = trim(Request.Form("ProdName")) ProdPhoto = trim(Request.Form("ProdPhoto")) ProdType = trim(Request.Form("ProdType")) if ProdName = "" then ProdName = " " end if if ProdPhoto = "" then ProdPhoto = " " end if if ProdType = "" then ProdType = " " end if sqlcmd = "Insert into ProdDisplay(ProdName, ProdPhoto, ProdType,) VALUES (" sqlcmd = sqlcmd & "'" & StripQuotes(ProdName) & "', " sqlcmd = sqlcmd & "'" & ProdPhoto & "', " sqlcmd = sqlcmd & "'" & ProdType & "', " dataCmd.CommandText = sqlcmd set upd = server.CreateObject("ADODB.Recordset") set upd = dataCmd.Execute Response.Redirect "updated.asp" end if %>




Reply With Quote