sql and asp getting an error after changing to sql 2005 syntax diff?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cwfontan
    New Member
    • Mar 2008
    • 1

    sql and asp getting an error after changing to sql 2005 syntax diff?

    I am uploading a file renaming it with text from input here is the sql insert code and error im getting. If you need more of the code let me know..

    This exact code is working when inserting into SQL 2000
    I duplicated the table script and ran it on SQL2005 with success and trying to get the code to now write to SQL2005 I have only change the connection string...

    suggestions?



    001.PDF File successfully written to disk.
    ADODB.Recordset error '800a0bb9'

    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

    /policyManagemen t/formPost.asp, line 11



    code =

    Code:
     If uploadObj.SaveToWeb("fileInput", uploadString) Then 
    
    				Response.Write("File successfully written to disk.")  
    				%><!--#include file="../Connections/policyMngDB.asp"--><%
    				formName = replace(formName,"'","''")
    				sql = "insert into formList "
    				sql = sql & "(formName, formNumber, uploadDate, userid, formStatus, fileName) "
    				sql = sql & "values('"& formName &"', '" & formNumber &"', '"& now &"', '"& session("loggedInUserid") &"', '1', '"& newFileName &"') "											
    		
    				set recordset = Server.Createobject("ADODB.RecordSet")
    				recordset.open sql, conn, 3, 3
    				
    				response.redirect("formView.asp")	
    					
    			Else 
    				Response.Write("There was an error saving the file to disk.") 
    			End If 
    	
    		 End If
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    cw,

    Try adding data in a recordset, this will at least show you where you have a problem:
    [code=asp]sql = "SELECT * FROM formList"

    set recordset = Server.Createob ject("ADODB.Rec ordSet")
    recordset.open sql, conn, 3, 3

    recordset.addne w
    recordset("form Name") = formName
    recordset("form Number") = formNumber
    recordset("uplo adDate") = now() ' I can never remember which dbs require dates
    'be entered as '3/17/08' and which as #3/17/08#, this is potentially where the
    'problem was
    recordset("user id") = session("logged InUser")
    recordset("form Status") = "1" '1 should not be in quotes if it is a numerical field
    'this is potentially where the problem was
    recordset("file Name") = newFileName
    recordset.updat e[/code]Let me know if this helps.

    Jared

    Comment

    Working...