1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

ASP Code Problem

Discussion in 'C#' started by Litespeed, Mar 20, 2007.

  1. druidelder

    druidelder Peon

    Messages:
    285
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Have you tried pulling data out of the database? I don't see anything here, but....

    Maybe try this and see if you get a different result:

    Replace these lines in your code:
    -------------------------------------
    Set rs = server.createobject("adodb.recordset")

    rs.open "user",cn
    rs.addnew
    rs("email") = Email
    rs("fname") = FName
    rs("lname") = LName
    rs.update

    rs.close
    Set rs = nothing

    With:
    -------------------------------------
    DIM strSQL
    Set rs = Server.CreateObject("ADODB.Connection")
    rs.Open conn

    strSQL = ""
    strSQL = strSQL & "INSERT INTO user "
    strSQL = strSQL & "(fname, lname, email) " & vbCrLf
    strSQL = strSQL & "VALUES ("
    strSQL = strSQL & "'" & fname & "'"
    strSQL = strSQL & ", "
    strSQL = strSQL & "'" & lname & "'"
    strSQL = strSQL & ", "
    strSQL = strSQL & "'" & email & "'"
    strSQL = strSQL & ");"

    rs.Execute strSQL, adCmdText Or adExecuteNoRecords

    rs.Close
    Set rs = Nothing
     
    druidelder, Mar 21, 2007 IP
  2. Litespeed

    Litespeed Guest

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    I inserted your code and at least it's throwing a different error message

    Error Type:
    ADODB.Connection (0x800A0E79)
    Operation is not allowed when the object is open.

    I hope this means we are getting close :)
     
    Litespeed, Mar 21, 2007 IP
  3. Litespeed

    Litespeed Guest

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    fixed that error, but now getting

    Microsoft OLE DB Provider for SQL Server (0x80040E14)
    Incorrect syntax near the keyword 'user'.
    /mine/testsignup.asp, line 67

    line 67 is
    rs.Execute strSQL, adCmdText Or adExecuteNoRecords
     
    Litespeed, Mar 21, 2007 IP
  4. Litespeed

    Litespeed Guest

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    got it... your code worked perfectly!

    I owe you many thanks and a six pack of your favorite beer!
     
    Litespeed, Mar 21, 2007 IP
  5. Litespeed

    Litespeed Guest

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    any guesses as to why the original code didn't work? I am VERY happy with code that works but knowing where I made the initial mistake is helpful to the learning process.

    Once again THANK YOU!!!!!!!
     
    Litespeed, Mar 21, 2007 IP
  6. druidelder

    druidelder Peon

    Messages:
    285
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #26
    I don't know. As far as code goes, I exhausted all my knowledge on the ideas that didn't work.
     
    druidelder, Mar 22, 2007 IP
  7. LuGeLaS

    LuGeLaS Peon

    Messages:
    242
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #27
    try to use conn.execute("sql commands")
     
    LuGeLaS, Apr 6, 2007 IP