Wrox Programmer Forums
|
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
 
Old January 31st, 2007, 09:51 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

In your Form action="<page.asp>" just supply the page that will handle the insert on that page as it will be called when you press the submit button.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
 
Old January 31st, 2007, 12:35 PM
Authorized User
 
Join Date: Jan 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mr.dparsons

I am busy with it already the whole day, i was wondering since i use dreamweaver.

With dreamweaver you are obliged to first select the table and than the records, somethingi did then each form on the register.asp get binded to the database and this seems to work something like this:
 <%=(Recordset1.Fields.Item("name").Value)%>

My question now:

Do i change the SELECT into INSERT or is the INSERT additionale ,and if not
could i conclude that dreamweaver is something else??

I had doubts about my database, so i made a otherone now without primary key
since i only have one table.
When i opened the page it have a alarm so i put a first record wich is name and then the page opened returning the name i put.
For my understanding i think i do understand now SELECT, thats wy i was wondering to change the SELECT to INSERT, wat is you're take on this.
I hope it is a bit understandeble wat i am writing here mr..
If the SQL:INSERT INTO is additionale do I put it under SELECT or has it a specific place on the page.


THX


 
Old January 31st, 2007, 12:44 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

...I am not sure i understand.

This statement:
<%=(Recordset1.Fields.Item("name").Value)%>

Writes out the value of the column 'name' to your page.

You will only use a SELECT Statement, if i understand you correctly, you will call this when your page first loads and that is it. When the user hits a button on your page, this is where you will call an INSERT statement, a select isnt necessary at that point.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
 
Old February 1st, 2007, 03:48 AM
Authorized User
 
Join Date: Jan 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mr.dparsons.

I think i understand,

If i put a submit buttom under on the page i am able to select onblur, onclick, ondubble click etc.
Do i put the INSERT INTO statement there after i selected onclick,
is this right mr.

As i told you this is the first time somebody is willing to give me information
about something i am still learning, i just want to be sure and to put in in my mind .



By the way sir what program is good 'the best' to use for ASP webpaging ?

THX



 
Old February 1st, 2007, 05:28 AM
Authorized User
 
Join Date: Jan 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mr.dparsons

Me again,
i was wondering if i maybe could send you the page and the database,the database is only 808kb and page is small.
For you to have a look at it and then to make it to work, if you do charge me
please not to much because we are a just started NPO and we dont make money as we would like.
Never the less we do now that you can not do this for free.

I don't now what do you think because i do a lot of things and nothing seems to work.

The page is there its only to make it to work with the database so that the database can be filled up via the page.

THX

NB I think i would be able to supplier a lot of job for you from South Africa.



 
Old February 1st, 2007, 08:18 AM
Authorized User
 
Join Date: Jan 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default




Hi mr dparsons.



<%@LANGUAGE="VBSCRIPT"%>

<%
Dim MM_nafcocyouth_STRING
MM_nafcocyouth_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\WEBS\business-youthlink.co.za/httpdocs/data/nafcocyouth.mdb"

MM_nafcocyouth_STRING..Execute("INSERT INTO companyprofile('10, 10100, 101200, 200, cc, cellphone, contacttel, datenamechanged, descriptofbusiness, designation, emailaddress, emailadressee, fax, female, govtdept, homelanguage, idno, industry, male, name, namet, ngo, ownership, phisicaladdress, plubliccom, postaladdres, postalcode, preferedlanguage, prevcompanyname, publishdesig, publishdesig1, publishemail, publishemail1, regdate, regno, section21, sector, soleowner, surnamet, taxregno, tel, title, tradingas, trust, typeofbusiness, vatregno ")")

MM_nafcocyouth_STRING..Close




%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 //EN">

Does this make since to you as a INSERT ststement

I think i am coming close to the solution of my problem, i hope so.

THX








 
Old February 1st, 2007, 09:35 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

First thing, your syntax is incorrrect on your INSERT ill get ot that in a second. Second off the string MM_nafcocyouth_STRING this appears to be your connection string and not an ADO object so, in that regard, you can not call MM_nafcocyouth_STRING.Execute because strings do not have an execute method.

This will help you with your connection:
http://www.w3schools.com/ado/ado_connect.asp

Now back to your insert statement. INSERT Statements have this form:

INSERT INTO [table](<names of the columns your inserting into>)VALUES(<the values you wish to insert>)

In the above example, all you have defined is an INSERT with a list of columns, no values.

Also, you will not use the onClick event of the button to raise your asp script, internally what happens is when you push a submit button, it posts the form to the page that is defined in your FORM Action (pushing a submit button is like calling form.submit(); in javascript)

So, you dont have to place any code in the submit button, just place the correct asp script as the form action.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
 
Old February 1st, 2007, 11:08 AM
Authorized User
 
Join Date: Jan 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mr.dparsons

I am not sure about VALUES, i think that VALUES are the details who must come via the page into the database example : <%= Recordset1.Fields.Item("sector").Value %> is this one VALUE or am i wrong,

thx

 
Old February 1st, 2007, 11:19 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

The 'VALUES' protion of an insert is the data you wish to place in the columns that you have defined in your column list. Consider this:

INSERT INTO myTable(entrydate, price, name_of_product)VALUES(getdate(), 7.95, 'A Cheap Widget')

What this would do, if executed in a database, would add a new row to the table 'myTable' so your table would look like this

entrydate price name_of_product
02/01/2007 7.95 A Cheap Widget

Your INSERT will need to be something like INSERT INTO TABLE(<columns you want to insert data into>)VALUES(" Request.Form("fielda") &"," & request.Form("FieldB")) etc etc etc.

(Remember, string literals need to be surrounded by ' ' number values do not.)



================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
 
Old February 2nd, 2007, 04:16 AM
Authorized User
 
Join Date: Jan 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi mr.dparsons

My again, i do have a lot of info now and i think i need to wakeup.

THX






Similar Threads
Thread Thread Starter Forum Replies Last Post
Register namespace using ASP deean Classic ASP Basics 0 June 16th, 2008 09:23 PM
ASP.NET not register under IIS evridiki ASP.NET 2.0 Basics 3 February 22nd, 2006 04:04 PM
Ch 15 Register.asp query daveyarwood BOOK: Beginning ASP 3.0 0 July 16th, 2005 12:52 PM
Register Globals Off cmiller Beginning PHP 4 August 18th, 2003 05:21 PM





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