Connect to the Database
Microsoft Access 2000 Database (OLE-DB):
Set db = Server.CreateObject("ADODB.Connection")
db.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("database.mdb") & ";"
Microsoft Access 2000 Database:
Set db = Server.CreateObject("ADODB.Connection")
db.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
Server.MapPath("database.mdb") & ";UID=;PWD="
Connecting to a database using a DSN:
Set db = Server.CreateObject("ADODB.Connection")
db.Open "DSN=mydsn;UID=username;PWD=password"
Delete Records:
db.execute("DELETE FROM mytable WHERE FullName = 'John Doe'")
Insert Records:
db.execute("INSERT INTO mytable VALUES ('John Doe', 22, '321 Disk Dr.',
'Hollywood, CA')
List Records:
set rs=db.execute("SELECT * FROM mytable")
rs.MoveFirst
Do Until rs.EOF
Response.Write rs("MyField") & "<br>"
Loop
Add, list, and delete records:
Set db = Server.CreateObject("ADODB.Connection")
db.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("database.mdb") & ";"
db.execute("INSERT INTO MyTable VALUES ('Dan Hendricks', 22)")
set rs=db.execute("SELECT * FROM MyTable")
rs.MoveFirst
Do Until rs.EOF
Response.Write rs("NAME") & "<br>"
rs.MoveNext
Loop
db.execute("DELETE FROM MyTable WHERE NAME = 'Dan Hendricks'")
Here is another quick and easy way to connect and list records:
'This code connects to the database.
set rs=Server.CreateObject("ADODB.Recordset")
db="DSN=TechSupport;UID=TechSupport;PWD=foobar"
'This code iterates through the current records.
mySQL = "SELECT * from chairs "
rs.open mySQL, db, 1, 3<-- Change the '3' to a '1' for a read-only. -->
rs.MoveFirst
Do Until rs.EOF
Response.Write rs("MyField") & "<br>"
rs.MoveNext
Loop
'This code deletes a record, and then adds a new one
rs.MoveFirst
rs.Delete
rs.AddNew
rs("Name") = 'Jane Doe'
rs.Update
rs.Close
/Ryan
_____
From: Jegatha [mailto:[EMAIL PROTECTED]
Sent: Monday, March 14, 2005 9:14 PM
To: [email protected]
Subject: RE: [AspClassicAnyQuestionIsOk] How to host
Hi
In my Host its enabled with ASP hosting.The rquest and response objects are
working proper.I want to know how to do the insertion and retriving with the
database.
really thanx 4 ur help
Ryan Olshan <[EMAIL PROTECTED]> wrote:
First you will need to have ASP enabled on your web hosting. Then all you
will have to do is upload the ASP pages. The MS Access database will have to
be in a write enabled directory so that data can be written to it.
/Ryan
_____
From: Jegatha [mailto:[EMAIL PROTECTED]
Sent: Monday, March 14, 2005 7:59 PM
To: [email protected]
Subject: [AspClassicAnyQuestionIsOk] How to host
hi
i am new to web hosting,i have space to host.But inside of that space only
HTML files are running.I dont know how to post tha ASP pages and
DATABASE(Ms-Access) inside of that space.Plz help me
thanks
regards
Jegatha
Yahoo! India Matrimony: Find your life partneronline.
[Non-text portions of this message have been removed]
Yahoo! Groups Sponsor
ADVERTISEMENT
<http://us.ard.yahoo.com/SIG=129hi728o/M=298184.6018725.7038619.3001176/D=gr
oups/S=1705006764:HM/EXP=1110945574/A=2593423/R=0/SIG=11el9gslf/*http://www.
netflix.com/Default?mqso=60190075> click here
<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=groups/S=
:HM/A=2593423/rand=947854163>
_____
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
cribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! India Matrimony: Find your life partneronline.
[Non-text portions of this message have been removed]
Yahoo! Groups Sponsor
ADVERTISEMENT
<http://us.ard.yahoo.com/SIG=129kihvth/M=298184.6018725.7038619.3001176/D=gr
oups/S=1705006764:HM/EXP=1110950027/A=2593423/R=0/SIG=11el9gslf/*http://www.
netflix.com/Default?mqso=60190075> click here
<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=groups/S=
:HM/A=2593423/rand=193168663>
_____
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
cribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/