Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old July 15th, 2003, 11:23 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i forgot, i placed this on the head of my code.

<%
'ASP update Engine by Milos Radivojevic
Function GetMemberDetails(id)
Dim cn
Dim sSQL
Dim rs
Dim ret_string
Set cn=Server.CreateObject("ADODB.Connection")


...helmut
Reply With Quote
  #22 (permalink)  
Old July 16th, 2003, 01:24 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help NNJ but still I'm not able to edit the contents and I'm getting error"Wrong parameter!!!" as per you code.I tried the same code and also changed the Primary key to username but no use.When I press the edit button against a particular person,in the second page ie., "second_page.asp" i get an error message "Wrong Parameter" as per the code.
More details regarding to this is given:-

I'm a beginner.Please do help me.

the structure of the table is as below:-

Database used:- MS-Access 2000
NAME OF THE TABLE-contacts



groupname-*

id(Autonumber)-PRIMARY KEY
Username(Name of the person)-Text(size-150)
MailAddr(Email-id of the person)-Text(Size-80)
Residence(Residential Address)-Text
Phone(Residence phone number)-Number
Fax(Residence Fax Number)-Number
Mobile(Mobile number)-Number
Company(Name of the company working)-Text
Address(Address of the company)-Text
dept(name of the department working)-Text
office(Office phone number)-Number
officefax(Company fax number)-Number
notes(General Notes)-Text

*groupname=This field contains registered username, when the user log into his account he will be able to view or edit the details pertaining to only his account and he should not be able to see other users account or records.

This is like a database website wherein a new user registers and a new space for his records is created under his name in groupname field in the table contacts.

I have entered details to the database and when i click the update button against particular person a new page should be opened wherein I can update fields.


Thanx
Pradeep










Reply With Quote
  #23 (permalink)  
Old July 16th, 2003, 04:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Pradeep,
Wrong parameter means that the condition "Request.QueryString("id")>0" is false. There is no sense to call GetMemberDetails function with the parameter different than positive integer.
Can you send what the address bar contains for the second page? In order to work properly it should be something like .../second_page.asp?id=xx where xx is a positive integer.

...but the Soon is eclipsed by the Moon
Reply With Quote
  #24 (permalink)  
Old July 18th, 2003, 07:40 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Posted - 07/16/2003 : 01:24:21 AM
--------------------------------------------------------------------------------

Thanks for your help NNJ but still I'm not able to edit the contents and I'm getting error"Wrong parameter!!!" as per you code.I tried the same code and also changed the Primary key to username but no use.When I press the edit button against a particular person,in the second page ie., "second_page.asp" i get an error message "Wrong Parameter" as per the code.
More details regarding to this is given:-

I'm a beginner.Please do help me.

the structure of the table is as below:-

Database used:- MS-Access 2000
NAME OF THE TABLE-contacts



groupname-*

id(Autonumber)-PRIMARY KEY
Username(Name of the person)-Text(size-150)
MailAddr(Email-id of the person)-Text(Size-80)
Residence(Residential Address)-Text
Phone(Residence phone number)-Number
Fax(Residence Fax Number)-Number
Mobile(Mobile number)-Number
Company(Name of the company working)-Text
Address(Address of the company)-Text
dept(name of the department working)-Text
office(Office phone number)-Number
officefax(Company fax number)-Number
notes(General Notes)-Text

*groupname=This field contains registered username, when the user log into his account he will be able to view or edit the details pertaining to only his account and he should not be able to see other users account or records.

This is like a database website wherein a new user registers and a new space for his records is created under his name in groupname field in the table contacts.

I have entered details to the database and when i click the update button against particular person a new page should be opened wherein I can update fields.


Thanx
Pradeep



Reply With Quote
  #25 (permalink)  
Old July 19th, 2003, 04:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Can you send what the address bar contains for the second page?

...but the Soon is eclipsed by the Moon
Reply With Quote
  #26 (permalink)  
Old July 19th, 2003, 04:32 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When I press the edit button against a particular person,in the second page
 ie., "second_page.asp" i get an error message "Wrong Parameter" as per the code
and the in the address bar, the address will be "http://local host/web/second_page.asp?id=22"
where web is the name of the directory where I have stored the asp files and the database
is stored in d:\.There is full permission given to the database to read, write etc.


Reply With Quote
  #27 (permalink)  
Old July 24th, 2003, 12:04 AM
Registered User
 
Join Date: Jul 2003
Location: Stevens Point, Wisconsin, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

NNJ, I've looked at your code, and I mean poured over it as I am facing a similar problem to Helmut and the original poster. I notice you are using the UPDATE SQL statement. Is UPDATE better/easier to use than INSERT INTO? The reason I am asking is I have an asp form where users enter information for a project request, I then want to put the information in the form into an Access dbase for later use. I thought you had to use an "INSERT INTO [TBl_Name](Variable1, Variable2,...) VALUES (request.form("variable1") "'&'" request.form("variable2") type query to do this... But, from looking at your code, it looks like you;re doing the same basic thing with an UPDATE. Am I reading it right???

JEff
Reply With Quote
  #28 (permalink)  
Old July 24th, 2003, 03:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Jeff, an UPDATE statement changes an existing record, whereas an INSERT statement creates a new record. That's the difference.

OK?
Phil
Reply With Quote
  #29 (permalink)  
Old July 24th, 2003, 04:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Pradeep,
Try this:
Replace this code piece from second page:
Code:
If Request.Form("submit")<>"" Then
    id=Request.Form("id")
    username=Request.Form("username")
    email=Request.Form("email")
    residence....
    If UpdateYourDB(id,username,email,residence,phone,fax,mobile,company,address,dept,office,officefax,notes)=1 Then
        Response.Write "Success message"
    Else
        Response.Write "Failed message"
    End If

Else
    If (Request.QueryString("id")>0) Then
        Response.Write "<form name=""form"" method=""post"" action=""second_page.asp"">"

        id=Request.QueryString("id")
        Response.Write GetMemberDetails(id)
        Response.Write "<input type=hidden name=id value=" & id & ">"
        Response.Write "<input type=submit name=submit value=""Update Changes"">"
        Response.Write "</form>"
    Else
        Response.Write "Wrong parameter!!!"
    End If
End If
with:
Code:
    If (Request.QueryString("id")>0) Then
        Response.Write "<form name=""form"" method=""post"" action=""second_page.asp"">"

        id=Request.QueryString("id")
        Response.Write GetMemberDetails(id)
        Response.Write "<input type=hidden name=id value=" & id & ">"
        Response.Write "<input type=submit name=submit value=""Update Changes"">"
        Response.Write "</form>"
    Else
        Response.Write "Wrong parameter!!!"
    End If


...but the Soon is eclipsed by the Moon
Reply With Quote
  #30 (permalink)  
Old September 9th, 2003, 07:00 AM
Authorized User
 
Join Date: Aug 2003
Location: , , India.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to spraveens
Default

Hi
     My Problem Is that when I execute the query " select * from customer where name='philip' ", and if there are no matching records then How do I display a message such as "no such records" ,please give me the code .

Thank You
Praveen...



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in updating records & finding records naveed77 VB Databases Basics 1 January 16th, 2007 12:12 PM
problem in updating records & finding records naveed77 VB How-To 1 January 16th, 2007 12:10 PM
Updating Records marmer Classic ASP Databases 1 August 23rd, 2003 11:12 AM
Updating records bspradeep Classic ASP Databases 0 August 20th, 2003 09:27 AM
Updating records help bspradeep Classic ASP Databases 0 July 7th, 2003 10:51 PM



All times are GMT -4. The time now is 07:03 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.