?
Solved

Internal Server Error 500

Posted on 2006-04-27
67
Medium Priority
?
1,859 Views
Last Modified: 2007-11-27
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
Comment
Question by:nikora1
  • 25
  • 18
  • 9
  • +4
67 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16559526
>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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16559726
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
 

Author Comment

by:nikora1
ID: 16559849
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

Expert Comment

by:hongjun
ID: 16560020
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
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 200 total points
ID: 16560045

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

Author Comment

by:nikora1
ID: 16560231
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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16560350
can you apply hongjun's comment?  post  your displayed results here please.
0
 

Author Comment

by:nikora1
ID: 16560385
Have applied hongjun's comment using I.E 7.0,  It still displays the "Internal Server Error 500"
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16560601
put these 2 lines at the very beginning of your .asp code


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

run your .asp and post your results
0
 

Author Comment

by:nikora1
ID: 16560747
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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16560861
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
 

Author Comment

by:nikora1
ID: 16560899
Sorry about that here's the new error

800a01f4|Variable_is_undefined:_'strSQL'
0
 

Author Comment

by:nikora1
ID: 16560919
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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16560965
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
 

Author Comment

by:nikora1
ID: 16560972
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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16560981
it does help.. so what does it say now?
0
 

Author Comment

by:nikora1
ID: 16561001
Reports this Error Code.

800a0bb9|Arguments_are_of_the_wrong_type__are_out_of_acceptable_range__or_are_in_conflict_with_one_another.
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16561050
which line of code is the error?
0
 

Author Comment

by:nikora1
ID: 16561103
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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16561126
you haven't set your strSQL variable to any query

such as

strSQL = "SELECT * FROM mydatabase"
0
 

Author Comment

by:nikora1
ID: 16561283
Can you give me an exact example of how to write this in my code. And where to place it exactly.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 16563141
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
 
LVL 33

Expert Comment

by:hongjun
ID: 16563154
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
 
LVL 10

Expert Comment

by:thefritterfatboy
ID: 16563337
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
 
LVL 22

Expert Comment

by:WMIF
ID: 16564765
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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16564866
oooh.. I get some sleep and everyone jumped in..

WMIF is right....like i initially pointed this out
0
 
LVL 22

Expert Comment

by:WMIF
ID: 16565541
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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16566051
@WMIF...ok..now it is just a waiting game....nikora1.. how are we doing?
0
 

Author Comment

by:nikora1
ID: 16566188
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
 
LVL 22

Expert Comment

by:WMIF
ID: 16566240
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
 

Author Comment

by:nikora1
ID: 16566282
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
 
LVL 22

Expert Comment

by:WMIF
ID: 16566296
quotes around the values, not the column names.  right now you have quotes around all of the values.  are they all string columns?
0
 
LVL 6

Expert Comment

by:John_Lennon
ID: 16566346
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
 

Author Comment

by:nikora1
ID: 16566407
Have changed to above statement, the following error now is generated:

|54|800a01a8|Object_required
0
 
LVL 22

Expert Comment

by:WMIF
ID: 16566442
what line is 54?
0
 

Author Comment

by:nikora1
ID: 16566500
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
 
LVL 22

Expert Comment

by:WMIF
ID: 16566539
Conn.Execute(Sql)

should be:

objCon.Execute(Sql)

that is the object that you created up above.
0
 

Author Comment

by:nikora1
ID: 16566555
Have changed the following error is now generated:

54|80040e14|[Microsoft][ODBC_Microsoft_Access_Driver]_Syntax_error_in_INSERT_INTO_statement
0
 
LVL 22

Expert Comment

by:WMIF
ID: 16566584
now make it look like this and post back the query that it gives you.

response.write sql
response.end()
objCon.Execute(Sql)
0
 
LVL 6

Expert Comment

by:John_Lennon
ID: 16566587
put this before objCon.Execute(sql) and post the result here

response.write sql
response.end
0
 
LVL 6

Expert Comment

by:John_Lennon
ID: 16566591
---> WMIF sorry, didn't see your post
0
 
LVL 22

Expert Comment

by:WMIF
ID: 16566593
no problem at all.  theres a bunch of us in here. :)
0
 

Author Comment

by:nikora1
ID: 16566604
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
 
LVL 22

Assisted Solution

by:WMIF
WMIF earned 400 total points
ID: 16566617
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
 

Author Comment

by:nikora1
ID: 16566630
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
 
LVL 6

Expert Comment

by:John_Lennon
ID: 16566667
comment this lines
response.write sql
response.end
0
 

Author Comment

by:nikora1
ID: 16566856
Have done so, now the following error appears

|56|80040e07|[Microsoft][ODBC_Microsoft_Access_Driver]_Data_type_mismatch_in_criteria_expression
0
 
LVL 6

Expert Comment

by:John_Lennon
ID: 16566946
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
 

Author Comment

by:nikora1
ID: 16567030
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
 
LVL 33

Expert Comment

by:hongjun
ID: 16567066
Please refer to this as well
http:#16563154

Your connection string is not set.
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16567103
I go away to work and look what I find...waiting..
0
 

Author Comment

by:nikora1
ID: 16567108
Have done so and received this error message

|57|80040e07|[Microsoft][ODBC_Microsoft_Access_Driver]_Data_type_mismatch_in_criteria_expression
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16567111
what's line 57?
0
 

Author Comment

by:nikora1
ID: 16567133
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
 
LVL 30

Accepted Solution

by:
Irwin Santos earned 1200 total points
ID: 16567158
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
 

Author Comment

by:nikora1
ID: 16567182
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
 
LVL 33

Assisted Solution

by:hongjun
hongjun earned 200 total points
ID: 16567223
You need single code for strings.

Sql="INSERT INTO registration (firstname) VALUES ('" & strfirstname & "')"
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16567227
@hongjun

single code = single quote  :-D

"
versus

'
0
 

Author Comment

by:nikora1
ID: 16567235
Thanks that worked, how would I write the rest of the code for all other fields?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 16567241
>>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
 

Author Comment

by:nikora1
ID: 16567346
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
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16567515
Y
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16567520
Whoops..

What value does "kanihi" return?
0
 

Author Comment

by:nikora1
ID: 16567553
Thanks for all your help, have solved the problem, checkbox in form was not assigned appropriate value, fixed that works well.
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16567554
ok.... so you're ALL good???

if so.... (look for split points above the comment box)  :-)
0
 
LVL 30

Expert Comment

by:Irwin Santos
ID: 16567555
YEEEHAWWW!!!!

Thank you!!
0
 
LVL 33

Expert Comment

by:hongjun
ID: 16568608
Glad your problem is solved.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question