Print Page | Close Window

Try Using AddNew Method

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=14987
Printed Date: 29 March 2026 at 9:21am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Try Using AddNew Method
Posted By: padoxky
Subject: Try Using AddNew Method
Date Posted: 09 May 2005 at 8:07am
Nice to be here again. To be here is either you have problem or hepling others so here for you to help me out.

I am trying to add new records to an exiting userID in access database.
Understand me very well, I created registration form for mulitiple users. When userA, userB AND userD done with registration and log in to they account to view they profile or edit it.
Then if I as an Administrator want to add new records to userB so that userA and userD with not see the new record i add to userB. So,I want each of them to have a different information in they profile.

I try to use AddNew method but is not working at all.
Help!

ThxNice to be here again. To be here is either you have problem or hepling others so here for you to help me out.

I am trying to add new records to an exiting userID in access database.
Understand me very well, I created registration form for mulitiple users. When userA, userB AND userD done with registration and log in to they account to view they profile or edit it.
Then if I as an Administrator want to add new records to userB so that userA and userD with not see the new record i add to userB vis visa. So,I want each of them to have a different information in they profile.

I try to use AddNew method but is not working at all.
Help!

Thx

-------------
NgWebDesigns



Replies:
Posted By: ub3rl337ch3ch
Date Posted: 09 May 2005 at 7:07pm
try using an sql insert
 
sql = "INSERT INTO tbl1 (col1, col2, col3) VALUES (val1, val2, val3)"
adoCon.Execute sql
 
to make it so that only userA can see userA's specific records, set a relationship between the key field of the user information table (the one where you keep passwords etc) and an equivalent field in the table where the new records will be kept.
 
For example, if userA has an ID number of 0001, then create a field in the table you want to add new things to called userID or something like that, and then use the sql insert to add the new record. Like this:
 
userIDvar = {the ID of the user}
sql = "INSERT INTO tbl2 (column1, column2, column3, userID) VALUES (value1, value2, value3, userIDvar)"
adoCon.Execute sql
 
hope that makes sense.


Posted By: padoxky
Date Posted: 08 June 2005 at 5:45am
 I don't really understand.
Doses it means that i shall have 2 tbls in my database. if i create the relationship shall i point it to tbl1 primary key and tbl2 primary key.
 
This is how i did mine:
 
userID = request.querystring("ID")
 
strVALS1 = request.form("txtVals1")
strVALS2 = request.form("txtVals2")
strVALS3 = request.form("txtVals3")
 
sql = "INSERT INTO ([col1,col2, col3, U_ID]) VALUES ('" & strVALS1 & "', '" & strVALS2 & "', '" & strVALS3 & "', userID)"
adCon.execute sql
 
But is still not working
 
In my admin area where i select the member i wish to add new records to it profile using it assign ID. That is the ID when the member get registered.
 
Just tell me how the 2 tbls is going to look like.
Please still help me out.


-------------
NgWebDesigns


Posted By: ub3rl337ch3ch
Date Posted: 13 June 2005 at 7:04pm
yes, two tables.
 
Table 1
One would have username, password and other relevant details (like contact details - phone number, address, etc) as well as a UserID field which would be and autonumber
 
Table 2
The other table would have whatever fields you need in it for the new records, as well as a UserID field which was simply text.
 
then you would set a one-to-many relationship from UserID in Table 1 to UserID in Table 2. Then use the sql insert into table 2, inserting userID as appropriate for the user.


Posted By: padoxky
Date Posted: 15 June 2005 at 6:04am
Thanks For your help, i really appreciate it.
More help please.
In Table2 the UserID will it be autonumber or a simply text.



-------------
NgWebDesigns


Posted By: ub3rl337ch3ch
Date Posted: 19 June 2005 at 7:03pm
text. it needs to be able to have multiple records with the same UserID, which autonumber will not allow


Posted By: pmormr
Date Posted: 20 June 2005 at 1:08am
I was never able to get the AddNew method to work for some reason. Stick to SQL.. it'll take you like ten minutes to learn the four basic functions (SELECT, UPDATE, INSERT INTO, DELETE).

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: padoxky
Date Posted: 14 July 2005 at 6:08am
Am very grateful for your help.
It works vey well now but i'm still having alittle problem.
 
How can i use SELECT METHOD to display the record in tbl2?
I try to do that but am having an error when i want to display it.
 
something like this:-
Error: Data type mismatch in criteria expression.
 
So, this is how i did mine.
 
userID = request.querystring("ID") 
 
strSQL = "SELECT [col1], [col2], [col3], [uid] FROM tbl2 WHERE uid=" & userID
 
But is not working. Plz, help me out.


-------------
NgWebDesigns


Posted By: padoxky
Date Posted: 14 July 2005 at 2:11pm
Remeber there's no primary key in tbl2 and no autonumber.

-------------
NgWebDesigns


Posted By: padoxky
Date Posted: 16 July 2005 at 4:58am
Is there anyone going to help me out?
 
ub3rl337ch3ch,
I expect you to help me out please

I want to displayed the records in tbl2.


-------------
NgWebDesigns


Posted By: pmormr
Date Posted: 16 July 2005 at 3:36pm
there are hundreds... if not thousands of articles on how to use the SQL SELECT command... use the magical google

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: padoxky
Date Posted: 18 July 2005 at 5:25am
hey  pmormr,
i suggest u read the last post before replying. Just read the previous post okay.
cox i know what am asking of.


-------------
NgWebDesigns


Posted By: pmormr
Date Posted: 19 July 2005 at 12:42am
Most of us are very knowledgeable about ASP and SQL and very generously provide our time to helping others out. Now if you're not going to show some effort then you might as well as hire a professional (i charge anywhere from 20-60 dollars per hour depending on the project)

Now, the datatype mismatch is due to the fact that you're missing single these thingys (') around UID, and you don't have to use the brackets around all your column names. You may only leave out the hyphens when you're using a number. The UID field is as you said before text, so it must be surrounded by hyphens or you get a datatype mismatch error (i.e. numbers don't work too well with strings) If you look into it more, there are also different symbols for different datatypes... that is stuff like the # symbol for dates.

strSQL = "SELECT col1, col2, col3, uid FROM tbl2 WHERE uid='" & userID & "';"


-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: padoxky
Date Posted: 19 July 2005 at 10:08am

Thank you pmormr,

 
I will apply this method u show me now.
i get to you when is okay.
 


-------------
NgWebDesigns


Posted By: padoxky
Date Posted: 19 July 2005 at 3:10pm
I have try the method no error again but, it display a
blank page instead of my web contents and info in my database.

-------------
NgWebDesigns


Posted By: pmormr
Date Posted: 20 July 2005 at 9:23pm
just opening the database isn't going to cause it to be displayed, you need to go through each record and print it to the screen. See this page: http://www.w3schools.com/ado/ado_recordset.asp - http://www.w3schools.com/ado/ado_recordset.asp

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net