-
Record Insertion; null value error...huh? help please
Hi All....again...really at a loss here,
I am trying to create a record insert page which then directs the user to a page displaying the inserted record.I keep encountering this error message:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] You tried to assign the Null value to a variable that is not a Variant data type.
/COPSNet/TMP1ij8jnd6i2.asp, line 116
Line 116 in my code is:
MM_editCmd.Execute
I am still very new to all of this and an explanation of what this means and any help will be appreciated. please see some of the page code below
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim rsCustType
Dim rsCustType_numRows
Set rsCustType = Server.CreateObject("ADODB.Recordset")
rsCustType.ActiveConnection = MM_COPS_STRING
rsCustType.Source = "SELECT * FROM CustomerType ORDER BY TypeCode ASC"
rsCustType.CursorType = 0
rsCustType.CursorLocation = 2
rsCustType.LockType = 1
rsCustType.Open()
rsCustType_numRows = 0
%>
<%
Dim rsContact
Dim rsContact_numRows
Set rsContact = Server.CreateObject("ADODB.Recordset")
rsContact.ActiveConnection = MM_COPS_STRING
rsContact.Source = "SELECT * FROM Contact ORDER BY ContactCode ASC"
rsContact.CursorType = 0
rsContact.CursorLocation = 2
rsContact.LockType = 1
rsContact.Open()
rsContact_numRows = 0
%>
<html><!-- InstanceBegin template="/Templates/COPSTEMP2.dwt.asp" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>COPSNetTemp</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
-
There are some variables being used here we can't see being set. I don't recommend posting more code, but I would suggest you start writing your variables to the client to see what values you are getting back.
IMHO, I wouldn't use DreamWeaver anymore. It just creates handicaps for the users and convoluded code.
Good luck,
Michael Sanchez
Managing Technical Editor
Forum Moderator
FreeVBCode.com
Similar Threads
-
Replies: 4
Last Post: 04-14-2006, 09:09 AM
-
By Colin McGuigan in forum Database
Replies: 12
Last Post: 04-15-2002, 07:43 AM
-
Replies: 1
Last Post: 11-27-2001, 06:53 AM
-
By Andrew McLellan in forum Java
Replies: 3
Last Post: 05-09-2001, 05:34 PM
-
By Bob Hines in forum Database
Replies: 7
Last Post: 04-27-2000, 11:14 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks