Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Simple ASP / MySQL Database Tutorial
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Simple ASP / MySQL Database Tutorial

 Post Reply Post Reply
Author
Roman View Drop Down
Newbie
Newbie


Joined: 21 January 2004
Location: Australia
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote Roman Quote  Post ReplyReply Direct Link To This Post Topic: Simple ASP / MySQL Database Tutorial
    Posted: 19 December 2005 at 6:35pm
Hi All,

Can someone direct me to a simple yet well explained tutorial for creating a MySQL database using ASP like Borg's ASP Access Guestbook tutorial which I found very helpful.

I'm migrating from Access to MySQL and know buggar all about MySQL.

Regards,

Back to Top
Meson View Drop Down
Newbie
Newbie
Avatar

Joined: 03 June 2003
Location: United States
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote Meson Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2006 at 9:17am
The only things you will need to know is this:
 
MySQL only supports ODBC connections.
MySQL only supports client side curosrs.
 
Other than the SQL syntax and the two items above, ASP with MySQL is similar  to ASP with Access.
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2006 at 5:00pm
You'll probably have to map field types as well as fields. Some conditional code logic may also need to change - e.g. yes/no vs 0/1.

Lead me not into temptation... I know the short cut, follow me.
Back to Top
Meson View Drop Down
Newbie
Newbie
Avatar

Joined: 03 June 2003
Location: United States
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote Meson Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2006 at 12:03pm
Thee lack of MySQL booleans is an issue, but most MySQL users use Enums or interger values. 0 is np/false,. 1 is yes/true, for instance.
Back to Top
site master View Drop Down
Newbie
Newbie


Joined: 08 January 2006
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote site master Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2006 at 2:01pm
MySql Tutrial(creating a database/tables useing ASP)

this is the code for connection to the mysql server(before creating the databse!)


Set Con = Server.CreateObject ("ADODB.Connection")

Con.open = "DRIVER={MySQL ODBC 3.51 Driver};"_
& "SERVER=localhost;"_
& "DATABASE=;"_
& "UID=root;PWD=; OPTION=35;"


server=your server
DATABASE=your databse(for now its empty we first need to create a databse)
UID=User Name(the user name, is you didnt chang it will be root)
PWD=your Password(the password will be empty if you wont chang it)

now after we connected to mysql we need to create a database
we will do this useing the command CREATE DATABASE


con.execute "create database  database  name"


after the databse was created we need to start useing it for creating tables later


con.execute "use database_name"


for creating a table we will use the command CREATE TABLE


con.execute "create table TableName(ID INT NOT NULL auto_increment," &_
"field_name VARCHAR(250) NOT NULL, PRIMARY KEY(ID))"


comman field types:
VARCHAR - same as text in Access
TEXT - same as memo in Access
INT - same as number in Access

full code:

Set Con = Server.CreateObject ("ADODB.Connection")

Con.open = "DRIVER={MySQL ODBC 3.51 Driver};"_
& "SERVER=localhost;"_
& "DATABASE=;"_
& "UID=root;PWD=; OPTION=35;"

con.execute "create database  database  name"

con.execute "use database_name"

con.execute "create table TableName(ID INT NOT NULL auto_increment," &_
"field_name VARCHAR(250) NOT NULL, PRIMARY KEY(ID))"

Con.Close
set Con = nothing

Response.write("finnished!")


Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2006 at 6:07pm
The Web Wiz Guestbook now supports mySQL.

Although not a tutorial every line of code is commented, so should hopefully help with what you need:-

www.webwizguestbook.com
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2006 at 6:10pm
Originally posted by Meson Meson wrote:

Thee lack of MySQL booleans is an issue, but most MySQL users use Enums or interger values. 0 is np/false,. 1 is yes/true, for instance.



 I believe version 5 of mySQL does support boolean values, and version 4.1 can use 'smallint' datatype for booleans although I find that the myODBC 3.51 drivers enters '0' for false and '-1' for true.


Edited by -boRg- - 10 January 2006 at 6:12pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.