Record Insertion; null value error...huh? help please


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Record Insertion; null value error...huh? help please

  1. #1
    Join Date
    Sep 2005
    Posts
    5

    Thumbs up 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>

  2. #2
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    202
    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

  1. Getting a GUI to run
    By Eric in forum Java
    Replies: 4
    Last Post: 04-14-2006, 10:09 AM
  2. Getting a large number of identities
    By Colin McGuigan in forum Database
    Replies: 12
    Last Post: 04-15-2002, 08:43 AM
  3. Getting a GUI to function
    By Eric in forum Java
    Replies: 1
    Last Post: 11-27-2001, 07:53 AM
  4. NullPointerException when reading text file
    By Andrew McLellan in forum Java
    Replies: 3
    Last Post: 05-09-2001, 06:34 PM
  5. Multi-row calculations
    By Bob Hines in forum Database
    Replies: 7
    Last Post: 04-27-2000, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center