PDA

View Full Version : Help Me Please


damionz
06-09-2005, 03:31 AM
Can anyone help me please... :(

when i open http://localhost/webblog/insertblog.asp , it show like this...

Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/webblog/insertblog.asp, line 22

and this is for my script...can anyone correct it, please...

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

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

<body>
<!-#include file="adovbs.inc"->

<% Dim oConn, objRs, letakfile %>
<% letakfile = Server.Mappath("blog.mdb") %>

<% Set oConn = Server.CreateObject("ADODB.Connection") %>
<% oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & letakfile %>

<% Set objRs = Server.CreateObject("ADODB.Recordset") %>
<% objRs.Open "webblog", oConn, adOpenKeySet, adLockOptimistic %>

<% randomize %>
<% acak=round(rnd * 1234567890) %>
<% acak="Blog" & acak %>
<% objRs.AddNew %>
<% objRs("BlogID")=acak %>
<% objRs("tanggal")=request.form("tanggal") %>
<% objRs("waktu")=request.form("pukul") %>
<% objRs("judul")=request.form("judul") %>
<% objRs("nama")=request.form("nama") %>
<% objRs("blog")=request.form("blog") %>
<% objRs.Update %>
<b>"<%=objRs("judul")%>"</b>

Tanggal: <%=objRs("tanggal")%>
Pukul: <%=objRs("waktu")%>
Dibuat oleh: <%=objRs("nama")%>

<%=objRs("blog")%>
<% objRs.Close%>

</body>
</html>

Any feedback greatly appreciated,

Acha :)

glenngv
06-09-2005, 06:14 AM
You included adovbs.inc incorrectly. It should be:

<!--#include file="adovbs.inc"-->

But do you really need to include that file? If you only want few constants, then you just copy the needed constants into your pages. That will prevent unused constants to be loaded to the memory. There's a good article about this:

Should I use ADOVBS.inc for declaring constants? (http://www.aspfaq.com/show.asp?id=2112)

damionz
06-09-2005, 06:19 AM
Yes..i have write it correctly..but now i have a new error..

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xd4 Thread 0x838 DBC 0x1386024 Jet'.
/webblog/insertblog.asp, line 19

line 19 should be this...

<% oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & letakfile %>

Freon22
06-09-2005, 06:33 AM
It looks like part of your trouble your is here. What are you trying to do here.
<% acak=round(rnd * 1234567890) %>

Also rewrite
<%
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.ConnectionString= "DRIVER={Microsoft Access Driver (*.mdb)};" &_
DBQ=" & Server.MapPath("blog.mdb")
oConn.Open
%>
It look cleaner and its easyer to read.


Another thing, this has nothing to do with your problem but I see you are only closing one object. You should also close your database connection and your should set them to nothing. I see people posting here are closing their recordsets, and database connections. But its also good to destory the object after you are done with it.
<%
objRs.Close
set objRs = Nothing
oConn.Close
set oConn = Nothing
%>

glenngv
06-09-2005, 06:41 AM
You can search ASP FAQ site (http://www.aspfaq.com/) for commonly encountered asp problems, that includes ADO problems. You can search the exact ADO error messages, I did just that using the error message you encountered and I saw this (http://www.aspfaq.com/show.asp?id=2154).

Freon22
06-09-2005, 02:34 PM
Never mind about this question, I see what you are doing. For so reason I was getting an error on it last night.
It looks like part of your trouble your is here. What are you trying to do here.
<% acak=round(rnd * 1234567890) %>


Edit:
Thanks glenngv that ASP FAQ site is nice, lot of good information there.