 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 19th, 2004, 03:06 AM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
unable to insert records into database
Hi All,
I am trying to create user login page. the name of page is login.asp. then user needs to enter user id, first name, last name, password, and email address. once user clicks on the submit button, it should go to savenewuser.asp page. and insert the new record into table tbllogin. i have the following code in savenewuser.asp.
i get the following error
Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/test/savenewuser.asp, line 29
My code in savenewuser.asp is following
<%@LANGUAGE="VBSCRIPT" %>
<% option explicit %>
<html>
<head>
<title>Save New User for Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
dim objrecordset
dim objConn
dim strSql
dim uid
dim fname
dim lname
dim password
dim email
uid = request.Form("txtuserid")
fname = request.Form("txtfname")
lname = request.Form("txtlname")
password = request.Form("txtpassword")
email = request.Form("txtemail")
objConn = Application("cnnNewConn")
set objrecordset = server.createobject("ADODB.recordset")
strSql = "INSERT INTO tbllogin(userid, fname, lname, password, email) values('"& uid &"', '"& fname &"', '"& lname &"', '"& password &"', '"& email &"')"
objrecordset.open strSql, objConn
objConn.close
set objrecordset = nothing
%>
</body>
</html>
Thanks in advance
|
|

March 19th, 2004, 03:40 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Everest...
You forget to put the database connection and you dont need to put
Set objrecordset = server.createobject("ADODB.Recordset") if you not gonna show
the value.is it make sense?
For example:
I'm using OLEDB, and for my table I'm using Access.
strConnect= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TblEmploy.mdb"
Set Conn= Server.CreateObject ("ADODB.Connection")
Conn.Open strConnect
then your insert syntax will be here.
I hope this will help you..
|
|

March 19th, 2004, 03:41 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi ya..
I am def no expert, but I has similar problems a while ago myself... have you checked to make sure the fields you are inserting into the Db are of the correct length and type.. ie.. uid = int5 etc.. otherwise the DB will reject the new data - thus the "arguments are of wrong tyope messgae etc...
Hope thats of some help!
|
|

March 19th, 2004, 03:26 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i have connection string as follows
objConn = "Driver={Microsoft Access Driver (*.MDB)}; DBQ=C:/Inetpub/wwwroot/test/LogDatabase.mdb"
still it gives me following errors
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'Driver={Microsoft Ac'
/test/savenewuser.asp, line 31
Thanks in advance
|
|

March 19th, 2004, 09:53 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
objConn.Open(<connection string>)
|
|

March 20th, 2004, 02:20 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi there,
Kindly note and note that:
Don't use general words to named the fields in the database like ( password,name,address,no,....) these will couse you many problems.
Regards,
ASP MAN
ali
|
|

March 21st, 2004, 07:17 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Quote:
quote:Originally posted by aliasp
Don't use general words to named the fields in the database like ( password,name,address,no,....) these will couse you many problems.
|
Would you kindly tell us why we shouldn't use "general words" as database fields? What would you recommend? What kind of problems would we have?
|
|

March 22nd, 2004, 04:42 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Names like Address should work fine. However, using a column named Password will indeed get you into troubles when using an Access database.
AFAIK, it's not really an official reserved word, and Access happily let's you create a column called Password. It even allows you to insert stuff in that column.
However, the problems come when you try to insert records over an OleDb or ODBC connection; you won't be able to use the Password column then without some tricks (enclosing it in angled brackets, I believe, should help.)
Look at the list with Reserved words, to see what is best to avoid: http://support.microsoft.com:80/supp.../Q109/3/12.asp
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 22nd, 2004, 10:59 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
For reserved words, I believe in your field names, you can specify [] around the name, and that should allow you to use those names. Someone correct me if I'm wrong...
|
|

March 22nd, 2004, 12:43 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Brian,
Yeah, that was my guess too. Would that work with all reserved words? I haven't really tried them out, except for Password and that worked.
Then again, maybe Reserved Words are called Reserved Words for a particular reason.... ;)
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |