Print Page | Close Window

Simple ASP / MySQL Database Tutorial

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=17584
Printed Date: 29 March 2026 at 3:11am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Simple ASP / MySQL Database Tutorial
Posted By: Roman
Subject: Simple ASP / MySQL Database Tutorial
Date 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,




Replies:
Posted By: Meson
Date 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.


Posted By: dpyers
Date 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.


Posted By: Meson
Date 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.


Posted By: site master
Date 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!")




-------------


Posted By: WebWiz-Bruce
Date 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:-

http://www.webwizguestbook.com - www.webwizguestbook.com


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: WebWiz-Bruce
Date 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.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



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