<% Dim strPhotoName 'Retrieve the data from the html form fields intGallery_ID = Request.Form("txtgalleryid") strPhotoName = Request.Form("filefield1") strPhoto_Caption = Request.Form("txtPhotoCaption") %> <% Dim strConnection ' database connection string Dim conn ' database connection Dim sql ' sql query 'Variables mapping the database fields Dim strPhoto_URL 'Connect to the database 'strConnection = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.MapPath("photogallery.mdb") & ";" 'strConnection ="Driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("photogallery.mdb") & ";" 'Set conn = Server.CreateObject("ADODB.Connection") 'conn.Open(strConnection) 'MySQL Connection strConnection = "Driver={MySQL ODBC 3.51 Driver}; Server=sql3de.your-server.co.za; Database=voiceofthecape; UID=vocfma_1; PWD=MJHEufA5; Option=3" Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open(strConnection) ' Add a new Photo to the database Sub AddPhoto(intGallery_ID, strPhoto_Caption, strPhoto_URL) sql = "INSERT INTO photo(Gallery_ID, Caption, URL) VALUES(" & Int(intGallery_ID) & ",'" & strPhoto_Caption & "','" & strPhoto_URL & "')" Response.Write sql conn.Execute(sql) End Sub 'Gather the fields for writing to the database strPhoto_URL = strPhotoName 'Write the database record Call AddPhoto(intGallery_ID, strPhoto_Caption, strPhoto_URL) %> <% response.redirect("gallerytool.asp?qryGalleryId=" & intGallery_ID) %>