Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSN less Connection to a database dont work HELP please

Status
Not open for further replies.

hemal666

Programmer
Dec 10, 2001
25
GB
hi,
ive got a asp page that tries to write to a data base, but it produces an error that i cant figure out
here's the error code:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name too long
/registerinterest.asp, line 43

heres my code:
<%@ Language=&quot;VBScript&quot; %>
<% Option Explicit %>
<% Response.Buffer = True %>
<html>
<head>

<% 'Create Cookie on client computer to allow the site to recognise the prospective client

'Variables
Dim sname , fname , add1 , add2 , pcode , daytel , evetel
Dim mobtel , btoc , detreq , Con , SQL , Application
Dim ipRS

'Obtain information from form
fname=Replace(Request.Form(&quot;fname&quot;),&quot;'&quot;,&quot;''&quot;)
sname=Replace(Request.Form(&quot;sname&quot;),&quot;'&quot;,&quot;''&quot;)
add1=Replace(Request.Form(&quot;add1&quot;),&quot;'&quot;,&quot;''&quot;)
add2=Replace(Request.Form(&quot;add2&quot;),&quot;'&quot;,&quot;''&quot;)
pcode=Replace(Request.Form(&quot;pcode&quot;),&quot;'&quot;,&quot;''&quot;)
daytel=Replace(Request.Form(&quot;daytel&quot;),&quot;'&quot;,&quot;''&quot;)
evetel=Replace(Request.Form(&quot;evetel&quot;),&quot;'&quot;,&quot;''&quot;)
mobtel=Replace(Request.Form(&quot;mobtel&quot;),&quot;'&quot;,&quot;''&quot;)
btoc=Replace(Request.Form(&quot;btoc&quot;),&quot;'&quot;,&quot;''&quot;)
detreq=Replace(Request.Form(&quot;detreq&quot;),&quot;'&quot;,&quot;''&quot;)
'Set Cookie
Response.Cookies(&quot;ProspectiveCookie&quot;)(&quot;fname&quot;) = fname
Response.Cookies(&quot;ProspectiveCookie&quot;)(&quot;sname&quot;) = sname
Response.Cookies(&quot;ProspectiveCookie&quot;)(&quot;dofinq&quot;) = Date
Response.Cookies(&quot;ProspectiveCookie&quot;).Expires = Date + 30 'write expiry date
Response.Cookies(&quot;ProspectiveCookie&quot;).Domain = &quot;pjosiah.co.uk&quot; 'write Domian name 4 access


%>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>

<%
Set Con = Server.CreateObject( &quot;ADODB.Connection&quot; )

Con.Open &quot;Providor=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;&Server.Mappath(&quot;databases/pj.mdb&quot;)&&quot;;&quot; 'line 43
'Insert record into the database
SQL = &quot;INSERT INTO reginterest(fname , sname , add1 , add2 , pcode , daytel , evetel, mobtel , btoc , detreq)VALUES('&quot;&fname&&quot;','&quot;&sname&&quot;','&quot;&add1&&quot;','&quot;&add2&&quot;','&quot;&pcode&&quot;','&quot;&daytel&&quot;','&quot;&evetel&&quot;','&quot;&mobtel&&quot;','&quot;&btoc&&quot;','&quot;&detreq&&quot;')&quot;

Set ipRS=Server.CreateObject(&quot;ADODB.Recordset&quot;)
ipRS.open SQL, con

MyConn.Close()
Set Conn = Nothing

response.write(&quot;done&quot;)

%>

</body>
</html>

thanx
 
give this a try instead
Con.Open &quot;DRIVER={Microsoft Access Driver (*.mdb)};&quot; & &quot;DBQ=&quot; & Server.MapPath(&quot;databases/pj.mdb&quot;) & &quot;;&quot;


the connection type you are doing is a OLEDB connection string and this may not be correct so try the ODBC and see if it works.
You may not have OLEDB avail Just a suggestion: faq183-874
admin@onpntwebdesigns.com
 
had aminute to look thru your code and have t\soem suggestions as well
fisrt don't do this <% something %> <% something else %>
do as little blocks as you need to. waist of server time
this <%@ vb.... is not needed. vbscript is ASP's default language so thus take it out. waist of server time. [smile]
OK.
one other thing.
I noticed names in the INSERT like date and code etc.. if these are numbers or dates you need to be aware that numbers only need &quot; &quot; surrounding them not '&quot; &quot;' and dates are surounded by # #
so for a date this would be the proper syntax
#&quot; & date & &quot;#
and a number or integer
&quot; & number & &quot;
now a character or string value
'&quot; & char & &quot;'

hope that helps you out Just a suggestion: faq183-874
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top