SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Very quirky oRS.Update problem

    I'm getting an odd response from on of my ASP pages. I'm trying to modify some records, but out of the bunch, two records result in errors when touched. Here's what I mean...

    '===================
    Set oConn = DBOpenConnection()
    Set oRS = Server.CreateObject("ADODB.Recordset")
    Set oRS.ActiveConnection = oConn
    oRS.Open "select * from tblScripts where pkID = " & numID, ,adOpenForwardOnly,adLockOptimistic

    oRS("TITLE") = Request.Form("Title")
    oRS("DESCRIPTION") = TextMakeSafe(Request.Form("Description"))
    'oRS("TEXT") = TextMakeSafe(Request.Form("Text"))
    oRS("CALLEDBY") = Request.Form("Calledby")
    oRS("PAGECALLED") = Request.Form("Pagecalled")
    'oRS("DATE") = Date
    oRS("OP1") = Request.Form("Op1")
    oRS("OP2") = Request.Form("Op2")
    oRS("OP3") = Request.Form("Op3")
    oRS("OP4") = Request.Form("Op4")
    oRS("OP5") = Request.Form("Op5")
    oRS("BCC") = Request.Form("Bcc")

    oRS.Update
    oRS.Close
    Set oRS = Nothing
    oConn.Close
    Set oConn = Nothing

    Response.Redirect "adminscripts.asp"
    '======================

    The above script runs without error, but if I remove the commenting from oRS("DATE") and/or oRS("TEXT") I get a "Syntax error in UPDATE statement." error. This completely stumps me.

    All help is enormously appreciated. Thanks
    marty_p

    MENZ.com site administrator.

  2. #2
    grasshoppa Snowbird122's Avatar
    Join Date
    Apr 2001
    Location
    Austin
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check to see if the words data and text are reserved words in your databse. Try renaming the fields.
    http://www.echo-consulting.net - Sound Solutions for Online Inspriations.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    that did it

    changing the names of those fields did indeed solve my problem, thanks enormously. I still don't understand the error, when I created the db I didn't reserve any words. Are some reserved by default? and how might I find out?
    marty_p

    MENZ.com site administrator.

  4. #4
    grasshoppa Snowbird122's Avatar
    Join Date
    Apr 2001
    Location
    Austin
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I found out the hard way that there are some words you just don't use for field names. I was using asp and access and I was using magazine names fields. Guess what, Time and Money are reserved!!

    I don't know where to find a list of these reserved works. Anyone?
    http://www.echo-consulting.net - Sound Solutions for Online Inspriations.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, i certainly do appreciate letting me learn from your mistakes. even if i never see a list of the reserved field names, i'll know what to try if i ever run into the problem again.
    marty_p

    MENZ.com site administrator.

  6. #6
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know where to find a list of these reserved works. Anyone?
    Look in the Access help files under
    Jet SQL Reference | Overview | SQL Reserved words

  7. #7
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I remember right, you can use reserved words, but when you refer to them using ASP, you have to inclose the name with [ and ], also, as a side-note, you can have spaces in the names, and when accesing them waith ASP, use [ and ].

    Tho, for better coding, its best to leave the reserved keywords alone.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •