• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1882
  • Last Modified:

Internal Server Error 500

I am receiving this error when I use an asp page to connect to my MS Access database, this was generated by my error logs:  

2006-04-26 22:13:25 W3SVC377 VPS10009 203.89.178.32 POST /insert.asp |9|80004005|[Microsoft][ODBC_Driver_Manager]_Data_source_name_not_found_and_no_default_driver_specified 80 - 203.109.235.157 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+InfoPath.1) - - www.ngaruahineiwi.co.nz 500 0 0 1625 676 109

Can any one help I do not understand what this means.
0
nikora1
Asked:
nikora1
  • 25
  • 18
  • 9
  • +4
4 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>Data_source_name_not_found_and_no_default_driver_specified
the connection string you use in the asp page is not correct, or the DSN Name specified does not exist (or is not accessible)
0
 
Irwin SantosComputer Integration SpecialistCommented:
ADMINISTRATIVE TOOLS  - DATA SOURCES (ODBC)...

click on the SYSTEM DSN tab... did you add your DSN?

to add to angelIII's comment....check your .asp look at your data source =
0
 
nikora1Author Commented:
The connection string in my ASP page that i am using is as follows.

<%

strDB4Access = "DRIVER={Microsoft Access Driver (registration.mdb)};uid=;pwd=;"
strDB4Access = strDB4Access & "DBQ=C:/inetpub/vhosts/ngaruahineiwi.co.nz/httpdocs/registration.mdb"

%>

I have provided read/write access to the database on the server. I have added the System DSN on my home PC but do i need to do this again as the problem is occuring on the server.
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
hongjunCommented:
Do this to see better error message on browser

Tools -> Internet Options
Go to the Advanced tab.
Make sure "Show friendly HTTP error message" is UNCHECKED.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:

please try this:
strDB4Access = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=;"
strDB4Access = strDB4Access & "DBQ=C:/inetpub/vhosts/ngaruahineiwi.co.nz/httpdocs/registration.mdb"
0
 
nikora1Author Commented:
I have completed the changes you suggested. The following error message now appears:

2006-04-28 08:33:27 W3SVC377 VPS10009 203.89.178.32 POST /insert.asp |12|800a0bb9|Arguments_are_of_the_wrong_type__are_out_of_acceptable_range__or_are_in_conflict_with_one_another. 80 - 203.109.235.157 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+InfoPath.1) - - www.ngaruahineiwi.co.nz 500 0 0 1625 607 171
0
 
Irwin SantosComputer Integration SpecialistCommented:
can you apply hongjun's comment?  post  your displayed results here please.
0
 
nikora1Author Commented:
Have applied hongjun's comment using I.E 7.0,  It still displays the "Internal Server Error 500"
0
 
Irwin SantosComputer Integration SpecialistCommented:
put these 2 lines at the very beginning of your .asp code


<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

run your .asp and post your results
0
 
nikora1Author Commented:
Have done as you asked here is the following error.

2006-04-28 09:50:12 W3SVC377 VPS10009 203.89.178.32 POST /insert.asp |9|800a01f4|Variable_is_undefined:_'objCon' 80 - 203.109.235.157 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+InfoPath.1) - - www.ngaruahineiwi.co.nz 500 0 0 1625 604 296
0
 
Irwin SantosComputer Integration SpecialistCommented:
ok.. first declare your variable...

Dim objCon

also, can you post the error message so that the lines have carriage returns.. makes it for easier reading
0
 
nikora1Author Commented:
Sorry about that here's the new error

800a01f4|Variable_is_undefined:_'strSQL'
0
 
nikora1Author Commented:
Have defined strSQL new error is.

800a0bb9|Arguments_are_of_the_wrong_type__are_out_of_acceptable_range__or_are_in_conflict_with_one_another.
0
 
Irwin SantosComputer Integration SpecialistCommented:
ok.
Dim strSQL

if you have any more undefined.. you have to declare them..   note that you can put them all on one DIM statement such as

Dim objCon, strSQL
0
 
nikora1Author Commented:
Here is the "insert.asp" page if that is helpful

<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

<!--#include file="connection.asp"-->

<%
Dim strDB4Access
Dim objCon
Dim objRs
Dim strSQL

Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open strDB4Access

Set objRs = Server.CreateObject ("ADODB.Recordset")
objRs.Open strSQL, objCon,1,3

'variables
Dim Conn, Sql
Dim strfirstname, strsurname, strmaidenname, strday, strmonth, stryear, straddress, strsuburb, strcity, stremailaddress, strhomephone, strworkphone, strmobile, strfax, stroccupation, strotherskills, strkanihi, strokahu, strngatimanu, strngatitu, strngatihaua, strngatitama, strunknown, strpost, stremail, strtruecorrect

'assign variables to items in the forms collection.
strfirstname = request.form("firstname")
strsurname = request.form("surname")
strmaidenname = request.form("maidenname")
strday = request.form("day")
strmonth = request.form("month")
stryear = request.form("year")
straddress = request.form("address")
strsuburb = request.form("suburb")
strcity = request.form("city")
stremailaddress = request.form("emailaddress")
strhomephone = request.form("homephone")
strworkphone = request.form("workphone")
strmobile = request.form("mobile")
strfax = request.form("fax")
stroccupation = request.form("occupation")
strotherskills = request.form("otherskills")
strkanihi = request.form("kanihi")
strokahu = request.form("okahu")
strngatimanu = request.form("ngatimanu")
strngatitu = request.form("ngatitu")
strngatihaua = request.form("ngatihaua")
strngatitama = request.form("ngatitama")
strunknown = request.form("unknown")
strpost = request.form("post")
stremail = request.form("email")
strtruecorrect = request.form("truecorrect")
 
'Sql statement to insert the data
Sql="INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('" _
        & strfirstname & "','" & strsurname & "','" & strmaidenname & "','" & strday & "','" & strmonth & "','" & stryear & "','" & straddress & "','" & strsuburb & "','" & strcity & "','" & stremailaddress & "','" & strhomephone & "','" & strworkphone & "','" & strmobile & "','" & strfax & "','" & stroccupation & "','" & strotherskills & "','" & strkanihi & "','" & strokahu & "','" & strngatimanu & "','" & strngatitu & "','" & strngatihaua & "','" & strngatitama & "','" & strunknown & "','" & strpost & "','" & stremail & "', '" & strtruecorrect & "')"

' execute it
Conn.Execute(Sql)

Response.Write "Data successfully inserted!"
%>
0
 
Irwin SantosComputer Integration SpecialistCommented:
it does help.. so what does it say now?
0
 
nikora1Author Commented:
Reports this Error Code.

800a0bb9|Arguments_are_of_the_wrong_type__are_out_of_acceptable_range__or_are_in_conflict_with_one_another.
0
 
Irwin SantosComputer Integration SpecialistCommented:
which line of code is the error?
0
 
nikora1Author Commented:
Only reports the following.

|16|800a0bb9|Arguments_are_of_the_wrong_type__are_out_of_acceptable_range__or_are_in_conflict_with_one_another.

And assuming that |16| means line 16. Hope this is useful.
0
 
Irwin SantosComputer Integration SpecialistCommented:
you haven't set your strSQL variable to any query

such as

strSQL = "SELECT * FROM mydatabase"
0
 
nikora1Author Commented:
Can you give me an exact example of how to write this in my code. And where to place it exactly.
0
 
hongjunCommented:
Try this

1. You need to use a connection object that has been opened correctly.
2. You do not need a recordset in this case.
3. Your sql statement has to be valid (not empty).


<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

<!--#include file="connection.asp"-->

<%
Dim strDB4Access
Dim objCon

strDB4Access = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=;"
strDB4Access = strDB4Access & "DBQ=C:/inetpub/vhosts/ngaruahineiwi.co.nz/httpdocs/registration.mdb"

Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open strDB4Access

'variables
Dim Sql
Dim strfirstname, strsurname, strmaidenname, strday, strmonth, stryear, straddress, strsuburb, strcity, stremailaddress, strhomephone, strworkphone, strmobile, strfax, stroccupation, strotherskills, strkanihi, strokahu, strngatimanu, strngatitu, strngatihaua, strngatitama, strunknown, strpost, stremail, strtruecorrect

'assign variables to items in the forms collection.
strfirstname = request.form("firstname")
strsurname = request.form("surname")
strmaidenname = request.form("maidenname")
strday = request.form("day")
strmonth = request.form("month")
stryear = request.form("year")
straddress = request.form("address")
strsuburb = request.form("suburb")
strcity = request.form("city")
stremailaddress = request.form("emailaddress")
strhomephone = request.form("homephone")
strworkphone = request.form("workphone")
strmobile = request.form("mobile")
strfax = request.form("fax")
stroccupation = request.form("occupation")
strotherskills = request.form("otherskills")
strkanihi = request.form("kanihi")
strokahu = request.form("okahu")
strngatimanu = request.form("ngatimanu")
strngatitu = request.form("ngatitu")
strngatihaua = request.form("ngatihaua")
strngatitama = request.form("ngatitama")
strunknown = request.form("unknown")
strpost = request.form("post")
stremail = request.form("email")
strtruecorrect = request.form("truecorrect")
 
'Sql statement to insert the data
Sql="INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('" _
       & strfirstname & "','" & strsurname & "','" & strmaidenname & "','" & strday & "','" & strmonth & "','" & stryear & "','" & straddress & "','" & strsuburb & "','" & strcity & "','" & stremailaddress & "','" & strhomephone & "','" & strworkphone & "','" & strmobile & "','" & strfax & "','" & stroccupation & "','" & strotherskills & "','" & strkanihi & "','" & strokahu & "','" & strngatimanu & "','" & strngatitu & "','" & strngatihaua & "','" & strngatitama & "','" & strunknown & "','" & strpost & "','" & stremail & "', '" & strtruecorrect & "')"

' execute it
objConn.Execute Sql

Response.Write "Data successfully inserted!"

objConn.Close
Set objConn = Nothing
%>


hongjun
0
 
hongjunCommented:
SORRY...
Some typos above


<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

<!--#include file="connection.asp"-->

<%
Dim strDB4Access
Dim objCon

strDB4Access = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=;"
strDB4Access = strDB4Access & "DBQ=C:/inetpub/vhosts/ngaruahineiwi.co.nz/httpdocs/registration.mdb"

Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open strDB4Access

'variables
Dim Sql
Dim strfirstname, strsurname, strmaidenname, strday, strmonth, stryear, straddress, strsuburb, strcity, stremailaddress, strhomephone, strworkphone, strmobile, strfax, stroccupation, strotherskills, strkanihi, strokahu, strngatimanu, strngatitu, strngatihaua, strngatitama, strunknown, strpost, stremail, strtruecorrect

'assign variables to items in the forms collection.
strfirstname = request.form("firstname")
strsurname = request.form("surname")
strmaidenname = request.form("maidenname")
strday = request.form("day")
strmonth = request.form("month")
stryear = request.form("year")
straddress = request.form("address")
strsuburb = request.form("suburb")
strcity = request.form("city")
stremailaddress = request.form("emailaddress")
strhomephone = request.form("homephone")
strworkphone = request.form("workphone")
strmobile = request.form("mobile")
strfax = request.form("fax")
stroccupation = request.form("occupation")
strotherskills = request.form("otherskills")
strkanihi = request.form("kanihi")
strokahu = request.form("okahu")
strngatimanu = request.form("ngatimanu")
strngatitu = request.form("ngatitu")
strngatihaua = request.form("ngatihaua")
strngatitama = request.form("ngatitama")
strunknown = request.form("unknown")
strpost = request.form("post")
stremail = request.form("email")
strtruecorrect = request.form("truecorrect")
 
'Sql statement to insert the data
Sql="INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('" _
       & strfirstname & "','" & strsurname & "','" & strmaidenname & "','" & strday & "','" & strmonth & "','" & stryear & "','" & straddress & "','" & strsuburb & "','" & strcity & "','" & stremailaddress & "','" & strhomephone & "','" & strworkphone & "','" & strmobile & "','" & strfax & "','" & stroccupation & "','" & strotherskills & "','" & strkanihi & "','" & strokahu & "','" & strngatimanu & "','" & strngatitu & "','" & strngatihaua & "','" & strngatitama & "','" & strunknown & "','" & strpost & "','" & stremail & "', '" & strtruecorrect & "')"

' execute it
objCon.Execute Sql

Response.Write "Data successfully inserted!"

objCon.Close
Set objCon = Nothing
%>


hongjun
0
 
thefritterfatboyCommented:
Can you run the code like this and show us the output from this page:


'assign variables to items in the forms collection.
strfirstname = replace(request.form("firstname"), "'", "''")
strsurname = replace(request.form("surname"), "'", "''")
strmaidenname = replace(request.form("maidenname"), "'", "''")
strday = replace(request.form("day"), "'", "''")
strmonth = replace(request.form("month"), "'", "''")
stryear = replace(request.form("year"), "'", "''")
straddress = replace(request.form("address"), "'", "''")
strsuburb =replace( request.form("suburb"), "'", "''")
strcity = replace(request.form("city"), "'", "''")
stremailaddress = replace(request.form("emailaddress"), "'", "''")
strhomephone = replace(request.form("homephone"), "'", "''")
strworkphone = replace(request.form("workphone"), "'", "''")
strmobile = replace(request.form("mobile"), "'", "''")
strfax = replace(request.form("fax"), "'", "''")
stroccupation = replace(request.form("occupation"), "'", "''")
strotherskills = replace(request.form("otherskills"), "'", "''")
strkanihi = replace(request.form("kanihi"), "'", "''")
strokahu = replace(request.form("okahu"), "'", "''")
strngatimanu = replace(request.form("ngatimanu"), "'", "''")
strngatitu = replace(request.form("ngatitu"), "'", "''")
strngatihaua = replace(request.form("ngatihaua"), "'", "''")
strngatitama = replace(request.form("ngatitama"), "'", "''")
strunknown = replace(request.form("unknown"), "'", "''")
strpost = replace(request.form("post"), "'", "''")
stremail = replace(request.form("email"), "'", "''")
strtruecorrect = replace(request.form("truecorrect"), "'", "''")
 
'Sql statement to insert the data
Sql="INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('" _
       & strfirstname & "','" & strsurname & "','" & strmaidenname & "','" & strday & "','" & strmonth & "','" & stryear & "','" & straddress & "','" & strsuburb & "','" & strcity & "','" & stremailaddress & "','" & strhomephone & "','" & strworkphone & "','" & strmobile & "','" & strfax & "','" & stroccupation & "','" & strotherskills & "','" & strkanihi & "','" & strokahu & "','" & strngatimanu & "','" & strngatitu & "','" & strngatihaua & "','" & strngatitama & "','" & strunknown & "','" & strpost & "','" & stremail & "', '" & strtruecorrect & "')"

response.write Sql
response.end

Response.Write "Data successfully inserted!"
0
 
WMIFCommented:
you have this at line 16:

objRs.Open strSQL, objCon,1,3

but you arent populating "strSQL" until after.  and then, you arent even using the recordset to insert the data.  comment out that line because you dont need it.

<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

<!--#include file="connection.asp"-->

<%
Dim strDB4Access
Dim objCon
Dim objRs
Dim strSQL

Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open strDB4Access

' Set objRs = Server.CreateObject ("ADODB.Recordset")
' objRs.Open strSQL, objCon,1,3
0
 
Irwin SantosComputer Integration SpecialistCommented:
oooh.. I get some sleep and everyone jumped in..

WMIF is right....like i initially pointed this out
0
 
WMIFCommented:
sorry irwinpks, i just reread your comment at http:#16561126 and realized thats what you were talking about.  he does have the query built later and is executing it through the connection object though, so commenting out those lines will fix this all.
0
 
Irwin SantosComputer Integration SpecialistCommented:
@WMIF...ok..now it is just a waiting game....nikora1.. how are we doing?
0
 
nikora1Author Commented:
Thanks for all your help so far, I have done what you suggested Irwinpks & WMIF, and now receive the following error message:

53|80040e07|[Microsoft][ODBC_Microsoft_Access_Driver]_Data_type_mismatch_in_criteria_expression

This must be on line 53
0
 
WMIFCommented:
now you need to go through each column of that query and make sure that columns expecting strings have single quotes surrounding the values and that columns expecting numbers do not have quotes.
0
 
nikora1Author Commented:
Have done the following

Sql="INSERT INTO registration ('firstname', 'surname', 'maidenname', day, month, year, 'address', 'suburb', 'city', 'emailaddress', homephone, workphone, mobile, fax, 'occupation', 'otherskills', 'kanihi', 'okahu', 'ngatimanu', 'ngatitu', 'ngatihaua', 'ngatitama', 'unknown', 'post', 'email', 'truecorrect') VALUES

The following error now appears

55|800a01a8|Object_required
0
 
WMIFCommented:
quotes around the values, not the column names.  right now you have quotes around all of the values.  are they all string columns?
0
 
John_LennonCommented:
your SQL should be like this

Sql="INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('" & strfirstname & "','" & strsurname & "','" & strmaidenname & "'," & strday & "," & strmonth & "," & stryear & ",'" & straddress & "','" & strsuburb & "','" & strcity & "','" & stremailaddress & "'," & strhomephone & "," & strworkphone & "," & strmobile & "," & strfax & ",'" & stroccupation & "','" & strotherskills & "','" & strkanihi & "','" & strokahu & "','" & strngatimanu & "','" & strngatitu & "','" & strngatihaua & "','" & strngatitama & "','" & strunknown & "','" & strpost & "','" & stremail & "', '" & strtruecorrect & "')"
0
 
nikora1Author Commented:
Have changed to above statement, the following error now is generated:

|54|800a01a8|Object_required
0
 
WMIFCommented:
what line is 54?
0
 
nikora1Author Commented:
Here is the code

<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

<!--#include file="connection.asp"-->

<%
Dim strDB4Access
Dim objCon
Dim objRs
Dim strSQL

Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open strDB4Access

' Set objRs = Server.CreateObject ("ADODB.Recordset")
' objRs.Open strSQL, objCon,1,3

'variables
Dim Conn, Sql
Dim strfirstname, strsurname, strmaidenname, strday, strmonth, stryear, straddress, strsuburb, strcity, stremailaddress, strhomephone, strworkphone, strmobile, strfax, stroccupation, strotherskills, strkanihi, strokahu, strngatimanu, strngatitu, strngatihaua, strngatitama, strunknown, strpost, stremail, strtruecorrect

'assign variables to items in the forms collection.
strfirstname = request.form("firstname")
strsurname = request.form("surname")
strmaidenname = request.form("maidenname")
strday = request.form("day")
strmonth = request.form("month")
stryear = request.form("year")
straddress = request.form("address")
strsuburb = request.form("suburb")
strcity = request.form("city")
stremailaddress = request.form("emailaddress")
strhomephone = request.form("homephone")
strworkphone = request.form("workphone")
strmobile = request.form("mobile")
strfax = request.form("fax")
stroccupation = request.form("occupation")
strotherskills = request.form("otherskills")
strkanihi = request.form("kanihi")
strokahu = request.form("okahu")
strngatimanu = request.form("ngatimanu")
strngatitu = request.form("ngatitu")
strngatihaua = request.form("ngatihaua")
strngatitama = request.form("ngatitama")
strunknown = request.form("unknown")
strpost = request.form("post")
stremail = request.form("email")
strtruecorrect = request.form("truecorrect")
 
'Sql statement to insert the data
Sql="INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('" & strfirstname & "','" & strsurname & "','" & strmaidenname & "'," & strday & "," & strmonth & "," & stryear & ",'" & straddress & "','" & strsuburb & "','" & strcity & "','" & stremailaddress & "'," & strhomephone & "," & strworkphone & "," & strmobile & "," & strfax & ",'" & stroccupation & "','" & strotherskills & "','" & strkanihi & "','" & strokahu & "','" & strngatimanu & "','" & strngatitu & "','" & strngatihaua & "','" & strngatitama & "','" & strunknown & "','" & strpost & "','" & stremail & "', '" & strtruecorrect & "')"

' execute it
Conn.Execute(Sql)

Response.Write "Data successfully inserted!"
%>
0
 
WMIFCommented:
Conn.Execute(Sql)

should be:

objCon.Execute(Sql)

that is the object that you created up above.
0
 
nikora1Author Commented:
Have changed the following error is now generated:

54|80040e14|[Microsoft][ODBC_Microsoft_Access_Driver]_Syntax_error_in_INSERT_INTO_statement
0
 
WMIFCommented:
now make it look like this and post back the query that it gives you.

response.write sql
response.end()
objCon.Execute(Sql)
0
 
John_LennonCommented:
put this before objCon.Execute(sql) and post the result here

response.write sql
response.end
0
 
John_LennonCommented:
---> WMIF sorry, didn't see your post
0
 
WMIFCommented:
no problem at all.  theres a bunch of us in here. :)
0
 
nikora1Author Commented:
Have made changes the following page appears once I hit submit

INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('dfsfds','sdfsdf','',1,1,1916,'','','','',,,,,'','','','','','','','','','','', '')
0
 
WMIFCommented:
i think the problem may be with those empty numeric values.

try putting a 0 in front so there is some number there:

Sql="INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('" & strfirstname & "','" & strsurname & "','" & strmaidenname & "',0" & strday & ",0" & strmonth & ",0" & stryear & ",'" & straddress & "','" & strsuburb & "','" & strcity & "','" & stremailaddress & "',0" & strhomephone & ",0" & strworkphone & ",0" & strmobile & ",0" & strfax & ",'" & stroccupation & "','" & strotherskills & "','" & strkanihi & "','" & strokahu & "','" & strngatimanu & "','" & strngatitu & "','" & strngatihaua & "','" & strngatitama & "','" & strunknown & "','" & strpost & "','" & stremail & "', '" & strtruecorrect & "')"
0
 
nikora1Author Commented:
Have made changes the following page still appears

INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('dfgfggdf','dfgfdgdfg','',01,01,01916,'','','','',0,0,0,0,'','','','','','','','','','','', '')
0
 
John_LennonCommented:
comment this lines
response.write sql
response.end
0
 
nikora1Author Commented:
Have done so, now the following error appears

|56|80040e07|[Microsoft][ODBC_Microsoft_Access_Driver]_Data_type_mismatch_in_criteria_expression
0
 
John_LennonCommented:
check again the table and see the type of your fields, if they are string, put quotes (') around in the sql statement,
according to your sql statement, your fields are

numerics
day, month, year, homephone, workphone, mobile, fax

strings
firstname, surname, maidenname, address, suburb, city, emailaddress, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect
0
 
nikora1Author Commented:
Still receiving the same error

56|80040e07|[Microsoft][ODBC_Microsoft_Access_Driver]_Data_type_mismatch_in_criteria_expression

Kanihi to truecorrect a check boxes would that make a difference.
0
 
hongjunCommented:
Please refer to this as well
http:#16563154

Your connection string is not set.
0
 
Irwin SantosComputer Integration SpecialistCommented:
I go away to work and look what I find...waiting..
0
 
nikora1Author Commented:
Have done so and received this error message

|57|80040e07|[Microsoft][ODBC_Microsoft_Access_Driver]_Data_type_mismatch_in_criteria_expression
0
 
Irwin SantosComputer Integration SpecialistCommented:
what's line 57?
0
 
nikora1Author Commented:
Heres the code

<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

<!--#include file="connection.asp"-->

<%
Dim strDB4Access
Dim objCon

Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open strDB4Access

strDB4Access = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=;"
strDB4Access = strDB4Access & "DBQ=C:/inetpub/vhosts/ngaruahineiwi.co.nz/httpdocs/registration.mdb"

Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open strDB4Access

'variables
Dim Sql
Dim strfirstname, strsurname, strmaidenname, strday, strmonth, stryear, straddress, strsuburb, strcity, stremailaddress, strhomephone, strworkphone, strmobile, strfax, stroccupation, strotherskills, strkanihi, strokahu, strngatimanu, strngatitu, strngatihaua, strngatitama, strunknown, strpost, stremail, strtruecorrect

'assign variables to items in the forms collection.
strfirstname = request.form("firstname")
strsurname = request.form("surname")
strmaidenname = request.form("maidenname")
strday = request.form("day")
strmonth = request.form("month")
stryear = request.form("year")
straddress = request.form("address")
strsuburb = request.form("suburb")
strcity = request.form("city")
stremailaddress = request.form("emailaddress")
strhomephone = request.form("homephone")
strworkphone = request.form("workphone")
strmobile = request.form("mobile")
strfax = request.form("fax")
stroccupation = request.form("occupation")
strotherskills = request.form("otherskills")
strkanihi = request.form("kanihi")
strokahu = request.form("okahu")
strngatimanu = request.form("ngatimanu")
strngatitu = request.form("ngatitu")
strngatihaua = request.form("ngatihaua")
strngatitama = request.form("ngatitama")
strunknown = request.form("unknown")
strpost = request.form("post")
stremail = request.form("email")
strtruecorrect = request.form("truecorrect")
 
'Sql statement to insert the data
Sql="INSERT INTO registration (firstname, surname, maidenname, day, month, year, address, suburb, city, emailaddress, homephone, workphone, mobile, fax, occupation, otherskills, kanihi, okahu, ngatimanu, ngatitu, ngatihaua, ngatitama, unknown, post, email, truecorrect) VALUES ('" & strfirstname & "','" & strsurname & "','" & strmaidenname & "',0" & strday & ",0" & strmonth & ",0" & stryear & ",'" & straddress & "','" & strsuburb & "','" & strcity & "','" & stremailaddress & "',0" & strhomephone & ",0" & strworkphone & ",0" & strmobile & ",0" & strfax & ",'" & stroccupation & "','" & strotherskills & "','" & strkanihi & "','" & strokahu & "','" & strngatimanu & "','" & strngatitu & "','" & strngatihaua & "','" & strngatitama & "','" & strunknown & "','" & strpost & "','" & stremail & "', '" & strtruecorrect & "')"

'execute it
'response.write sql
'response.end()
objCon.Execute Sql

Response.Write "Data successfully inserted!"

objCon.Close
Set objCon = Nothing
%>
0
 
Irwin SantosComputer Integration SpecialistCommented:
What would help is if you not jam all your code in at one time in your SQL string.  Start with something simple so that the entire code works functionally.  For example

Sql="INSERT INTO registration (firstname) VALUES (" & strfirstname & ")"

Does the code work then?
0
 
nikora1Author Commented:
I took out my SQL string and placed the above in, the following error message appeared

|57|80040e10|[Microsoft][ODBC_Microsoft_Access_Driver]_Too_few_parameters
0
 
hongjunCommented:
You need single code for strings.

Sql="INSERT INTO registration (firstname) VALUES ('" & strfirstname & "')"
0
 
Irwin SantosComputer Integration SpecialistCommented:
@hongjun

single code = single quote  :-D

"
versus

'
0
 
nikora1Author Commented:
Thanks that worked, how would I write the rest of the code for all other fields?
0
 
hongjunCommented:
>>how would I write the rest of the code for all other fields?
Same rule applies.

Single quote around string values
No single quote for integer/float values
0
 
nikora1Author Commented:
I added each field one at a time then tested when I got the Kanihi which is the first check box the following error message appeared

|57|80040e07|[Microsoft][ODBC_Microsoft_Access_Driver]_Data_type_mismatch_in_criteria_expression

What should these fields be saved as in the database I have used the Yes/No data type. Each has a check box associated in the form.
0
 
Irwin SantosComputer Integration SpecialistCommented:
Y
0
 
Irwin SantosComputer Integration SpecialistCommented:
Whoops..

What value does "kanihi" return?
0
 
nikora1Author Commented:
Thanks for all your help, have solved the problem, checkbox in form was not assigned appropriate value, fixed that works well.
0
 
Irwin SantosComputer Integration SpecialistCommented:
ok.... so you're ALL good???

if so.... (look for split points above the comment box)  :-)
0
 
Irwin SantosComputer Integration SpecialistCommented:
YEEEHAWWW!!!!

Thank you!!
0
 
hongjunCommented:
Glad your problem is solved.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 25
  • 18
  • 9
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now