%
If Session("logged") <> "1" Then
Response.Redirect("login.asp")
End If
%>
Update Products
<%
Dim DateID, ConnectionString, cnUpd, recProducts, upl
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../db/db1.mdb") & ";"
Set upl = Server.CreateObject("SoftArtisans.FileUp")
If upl.Form("sended") = "1" Then
Set cnUpd = Server.CreateObject("ADODB.Connection")
cnUpd.Open ConnectionString
Dim updated
updated = 0
If Request.QueryString("upd") = "1" Then
Set recProducts = Server.CreateObject("ADODB.Recordset")
recProducts.Open "Select * From Products WHERE id = " & Request.QueryString("id"), cnUpd, 1, 3
If Not recProducts.EOF Then
If Trim(upl.Form("name")) <> "" Then
recProducts("ProductsName") = Trim(upl.Form("name"))
recProducts("ProductsDescription") = Trim(upl.Form("desc"))
If upl.Form("img").IsEmpty = False Then
If recProducts("ProductsImage") <> "" Then
On Error Resume Next
Set objFile = Server.CreateObject("SoftArtisans.FileManager")
objFile.DeleteFile Server.MapPath("../") & "\" & recProducts("ProductsImage"), True
Set objFile = Nothing
End If
upl.Path = Server.MapPath("../images")
Dim NewFileNameU
NewFileNameU = "Pr" & recProducts("id") & _
Mid(upl.Form("img" & recProducts("id")).UserFilename, InstrRev(upl.Form("img" & recProducts("id")).UserFilename, "\") + 1)
upl.Form("img" & recProducts("id")).SaveAs upl.Path & "\" & NewFileNameU
recProducts("ProductsImage") = "images/" & NewFileNameU
End If
If upl.Form("show") <> "" Then
recProducts("ShowProducts") = True
Else
recProducts("ShowProducts") = False
End If
recProducts.UpdateBatch
updated = 1
End If
End If
recProducts.Close
Set recProducts = Nothing
If updated = 1 Then
Response.Write("")
End If
End If
cnUpd.Close
Set cnUpd = Nothing
Set recProducts = Nothing
End If
%>
Here You can update Products
<%
Dim iPos, lgID, pageNumber
Set cnUpd = Server.CreateObject("ADODB.Connection")
cnUpd.Open ConnectionString
Set recProducts = Server.CreateObject("ADODB.Recordset")
recProducts.Open "Select * From Products WHERE id = " & Request.QueryString("id"), cnUpd, adForwardOnly
%>
Back to list of products