|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
error 80040e14
I am having trouble sending data to an MS Access database table. I keep getting the error 80040e14 insert into...referencing line 95 of the following code (in red).
I've looked at the troubleshooting tips. The fields in the table are ID, q1, q2, ... , q131. I changed them from number to text, still nothing. The forms are R1, R2, .... R131. <!-- #include file="debug.inc" --> <!-- #include file="adovbs.inc" --> <% '------------------------------------------------------------------------------- ' Global Variables '------------------------------------------------------------------------------- dim con 'holds a Connection object dim rec 'holds a Recordset object sub OpenConnection(ByVal fname) '------------------------------------------------------------------------------- ' Opens a connection to a database ' The following database formats are supported: ' MS Access ' MS Excel (data must be in tabular form) ' Text (comma-separated values) ' ' *Note: Right now Text is nonfunctioning. '------------------------------------------------------------------------------- ' Pre: fname is the name of a file that exists in the same directory as the ' ASP script calling this function OR a fully qualified file name. ' Post: global variable con = an open connection to the database '------------------------------------------------------------------------------- dim ext, FSO set con = Server.CreateObject("ADODB.Connection") con.Provider = "Microsoft.Jet.OLEDB.4.0" 'Check the file's extension to make sure it is a valid type ext = lcase(right(fname, 3)) if ext = "mdb" then 'Do nothing. The Jet engine works natively with MS Access elseif ext = "xls" then con.Properties("Extended Properties") = "Excel 8.0;" elseif ext = "txt" then con.Properties("Extended Properties") = "Text;" else debugWrite "OpenConnection() failure:" & NL & "Unsupported file extension: " & ext Exit Sub end if 'Get full path of file name set FSO = Server.CreateObject("Scripting.FileSystemObject") 'If it's a simple file name then get the fully qualified path if fname = FSO.GetFileName(fname) then fname = Server.MapPath(fname) set FSO = nothing con.Properties("Data Source") = fname if Session("globalDebug") then debugWrite "con.ConnectionString = " & con.ConnectionString con.Open end sub sub CloseConnection '------------------------------------------------------------------------------- ' Closes the open connection '------------------------------------------------------------------------------- ' Pre: global var con has an open connection ' Post: global var con = Nothing '------------------------------------------------------------------------------- con.Close set con = Nothing end sub sub OpenRecordset(sql) '------------------------------------------------------------------------------- ' Opens a read-only recordset with the specified query ' sql may be a valid SQL statement or the name of a table. ' Table names must be surrounded by brackets (i.e. [tablename]). ' The name of a table for an Excel database is the sheet name, followed by ' a $, followed optionally by a range (i.e. [sheetname$A1:F4]). If the range ' is ommitted the OLEDB driver will use whatever tabular data it finds on the ' sheet. You still need to put the $ if ommitting the range ' (i.e. [sheetname$]). '------------------------------------------------------------------------------- ' Pre: sql has value ' Post: global variable rec = the Recordset return by the SQL statement '------------------------------------------------------------------------------- dim cmdType set rec = Server.CreateObject("ADODB.Recordset") sql = trim(sql) if (left(sql,1) = "[") and (right(sql,1) = "]") then cmdType = adCmdTable else cmdType = adCmdText end if if Session("globalDebug") then debugWrite "SQL = " & sql rec.CursorType = adOpenKeyset rec.Open sql, con, , adLockOptimistic, cmdType end sub sub CloseRecordset '------------------------------------------------------------------------------- ' Closes the open recordset '------------------------------------------------------------------------------- ' Pre: global var rec has an open recordset ' Post: global var rec = Nothing '------------------------------------------------------------------------------- rec.Close set rec = Nothing end sub Function Escape(StringToEscape) Escape = Replace(StringToEscape, "'", "''") End Function Function EscapeForJS(StringToEscape) EscapeForJS = Replace(StringToEscape, Chr(34), "\" & Chr(34)) End Function Function findLink(strText) Dim str1, temp, i, arElem 'str1 = strText If strText > "" Then temp = split(strText, "$") i = 0 For Each arElem in temp If inStr(temp(i), "http://") > 0 Then temp(i) = "<a href=""" & temp(i) & """ target = ""_n"">" & temp(i) & "</a>" End If findLink = findLink & temp(i) i = i + 1 Next Else findLink = strText End If End Function %> |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > error 80040e14 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|