Please help me with SYNTAX!

Results 1 to 5 of 5

Thread: Please help me with SYNTAX!

  1. #1
    Burger Queen Guest

    Default Please help me with SYNTAX!

    I have placed this code on my response page. I am trying to INSERT to a table that already exists. The table is called tblStaff, with a field called DepAsstComm. The referring control from the main page is called DepAsstComm. I want to put the DepAsstComm value into the table, where the primary key of the table (tblStaff("ID")) is equal to the value of a variable called Entry. I think my syntax is off. I get an expected end of statement error. Could use some assistance.<BR><BR>dim objconn<BR>set objconn = server.CreateObject ("ADODB.Connection")<BR>objconn.Open Application("BoardAction_ConnectionString")<BR>dim strSql,objrs2<BR>set objrs2 = server.CreateObject ("ADODB.recordset")<BR>strSql = "INSERT INTO tblStaff.DepAsstComm &#039;"&request("DepAsstComm")&"&#039; WHERE tblStaff("ID") = Entry"<BR>objrs2.Open strSql,objconn<BR><BR>objrs2.Close<BR>set objrs2 = nothing<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Please help me with SYNTAX!

    Yeah, you can&#039;t insert like that... just use the table name<BR><BR>INSERT into Tablename (fieldnames)<BR>VALUES(blah)<BR><BR>No such thing as a WHERE when you do an insert.

  3. #3
    Burger queen Guest

    Default Then...

    How would you suggest I go about doing this? Should I SELECT the Recordset that includes the PrimaryKey I am looking for, and then INSERT INTO that?

  4. #4
    Join Date
    Dec 1969

    Default RE: Then...

    You want an UPDATE statement<BR><BR>UPDATE tablename<BR>SET fieldname = something<BR>WHERE something = something<BR><BR><BR>Your where clause will hold your primary key.

  5. #5
    Booger queen Guest

    Default Me love you long time

    sucky, sucky

Posting Permissions

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