Forums

This topic is locked

insert record problem

Posted 20 Sep 2002 01:33:50
1
has voted
20 Sep 2002 01:33:50 Barbara Perzyna posted:
I am trying to create an insert record page in Dreamweaver MX but keep getting this error message. I have tried everything I could think of and wondered if anyone has ever come across this problem and found a solution. Thanks...

ADODB.Command error '800a0bb9'

The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.

/enterrecords.asp, line 113

Replies

Replied 20 Sep 2002 13:34:21
20 Sep 2002 13:34:21 Andrew Watson replied:
check your field names, dont use date for example, check the insert SQL string is valid, ie. text has ' ' delimeters, numbers dont etc if no joy,

post your code
Cheers

Leed

:: Son, im Thirty.... ::
Replied 22 Sep 2002 04:30:44
22 Sep 2002 04:30:44 Barbara Perzyna replied:
I couldn't find what was wrong. Here is the code.
If (CStr(Request("MM_insert") = "form1" Then

MM_editConnection = MM_metro_one_STRING
MM_editTable = "application"
MM_editRedirectUrl = ""
MM_fieldsStr = "tfirstname|value|tlastname|value|taddress|value|taddress2|value|tcity|value|tstate|value|tzip|value|tphone|value|tpager|value|tbirthdate|value|tsocsec|value|cbcitizen|value|tgreencard|value|cbcar|value|cblicense|value|cbpolice|value|cbpolactive|value|cbgun|value|tfrom1|value|tto1|value|tfemployer1|value|tfaddress1|value|tfcity1|value|tfstate1|value|tfzip1|value|tfphone1|value|tfsalary1|value|tfreasonleft1|value|tfrom2|value|tto2|value|tfemployer2|value|tfaddress2|value|tfcity2|value|tfstate2|value|tfzip2|value|tfphone2|value|tfsalary2|value|tfreasonleft2|value|tfrom3|value|tto3|value|tfemployer3|value|tfaddress3|value|tfcity3|value|tfstate3|value|tfzip3|value|tfphone3|value|tfsalary3|value|tfreasonleft3|value|tfrom4|value|tto4|value|tfemployer4|value|tfaddress4|value|tfcity4|value|tfstate4|value|tfzip4|value|tfphone4|value|tfreasonleft4|value|treference1|value|traddress1|value|trcity1|value|trstate1|value|trzip1|value|trphone1|value|trbusiness1|value|trname2|value|traddress2|value|trcity2|value|trstate2|value|trzip2|value|trphone2|value|trbusiness2|value|treference3|value|traddress3|value|trcity3|value|trstate3|value|trzip3|value|trphone3|value|trbusiness3|value|cbconvicted|value|cbconfined|value|cbwarrants|value|cbshoplifted|value|cbparole|value|cbprobation|value|cbarrests|value|tfarrestreason|value|cbdrugs|value|tfdrugreason|value|thighschool|value|thsyears|value|tcollege|value|tcollegeyears|value|taddtled|value|thealth|value|tmeds|value|cbhospital|value|thospreason|value|LMappliedfor|value|LMregreq|value|tinterviewed|value|treqsalary|value|tcomments|value"
MM_columnsStr = "firstname|',none,''|lastname|',none,''|address|',none,''|address1|',none,''|city|',none,''|state|',none,''|zip|',none,''|phone|',none,''|pager|',none,''|birthdate|',none,''|socialsecurity|',none,''|citizen|none,'Y','N'|greencard|none,'Y','N'|car|none,'Y','N'|driverslicense|none,'Y','N'|policeofficer|none,'Y','N'|active|none,'Y','N'|gunpermit|none,'Y','N'|from1|',none,''|to1|',none,''|formeremployer1|',none,''|faddress1|',none,''|fcity1|',none,''|fstate1|',none,''|fzip1|',none,''|fphone1|',none,''|salary1|',none,''|reasonleaving1|',none,''|from2|',none,''|to2|',none,''|formeremployer2|',none,''|faddress2|',none,''|fcity2|',none,''|fstate2|',none,''|fzip2|',none,''|fphone2|',none,''|salary2|',none,''|reasonleaving2|',none,''|from3|',none,''|to3|',none,''|formeremployer3|',none,''|faddress3|',none,''|fcity3|',none,''|fstate3|',none,''|fzip3|',none,''|fphone3|',none,''|salary3|',none,''|reasonleaving3|',none,''|from4|',none,''|to4|',none,''|formeremployer4|',none,''|faddress4|',none,''|fcity4|',none,''|fstate4|',none,''|fzip4|',none,''|fphone4|',none,''|reasonleaving4|',none,''|reference1|',none,''|raddress1|',none,''|rcity1|',none,''|rstate1|',none,''|rzip1|',none,''|rphone1|',none,''|rbusiness1|',none,''|reference2|',none,''|raddress2|',none,''|rcity2|',none,''|rstate2|',none,''|rzip2|',none,''|rphone2|',none,''|rbusiness2|',none,''|reference3|',none,''|raddress3|',none,''|rcity3|',none,''|rstate3|',none,''|rzip3|',none,''|rphone3|',none,''|rbusiness3|',none,''|convicted|none,'Y','N'|confined|none,'Y','N'|warrants|none,'Y','N'|shoplift|none,'Y','N'|parole|none,'Y','N'|probation|none,'Y','N'|arrests|none,'Y','N'|arrestreason|',none,''|drugs|none,'Y','N'|drugreason|',none,''|highschool|',none,''|hsyears|',none,''|college|',none,''|collegeyears|',none,''|additionaled|',none,''|health|',none,''|medication|',none,''|hospitalized|none,'Y','N'|reasonhospitalized|',none,''|positionapplied|',none,''|region|',none,''|interviewedby|',none,''|salaryrequired|',none,''|comments|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert") <> "" Then

' 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
%>

Reply to this topic