|
-
Aug 18th, 2009, 05:31 AM
#1
Thread Starter
Hyperactive Member
Create Databse in MySQL
How to create database in my mysql if it the database name is not currently true in mysql? Using vb.net
How to check if database name is already created or available in my localhost using vb.net.
VB 6.0 = "Self-Study" Then
vb.NET = "Self-Study" Then
C# = 'on going study.....
-
Aug 18th, 2009, 05:34 AM
#2
Re: Create Databse in MySQL
Inside the IDE? Or when running the application? Or with some other tool?
Rate People That Helped You
Mark Thread Resolved When Resolved
-
Aug 18th, 2009, 05:36 AM
#3
Thread Starter
Hyperactive Member
Re: Create Databse in MySQL
I want to create a function that check and create a database if is not present in my localhost.
VB 6.0 = "Self-Study" Then
vb.NET = "Self-Study" Then
C# = 'on going study.....
-
Aug 18th, 2009, 05:40 AM
#4
Re: Create Databse in MySQL
If you want to only check if the database you can do this:
Code:
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'Name'
If you want to create the DB if the DB not exists
Code:
CREATE DATABASE IF NOT EXISTS Name;
Rate People That Helped You
Mark Thread Resolved When Resolved
-
Aug 18th, 2009, 05:46 AM
#5
Thread Starter
Hyperactive Member
Re: Create Databse in MySQL
btw it is my sql script i want to create if the database is not exist:
Code:
CREATE DATABASE transaction;
USE transaction;
CREATE TABLE clients
(
client_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
lastname CHAR(40) NOT NULL,
firstname CHAR(40) NOT NULL,
phone CHAR(20) NOT NULL,
credits CHAR(20) NOT NULL,
)TYPE = MyISAM;
is that possible to execute that in my form? I am using MySQL Server 5.0
VB 6.0 = "Self-Study" Then
vb.NET = "Self-Study" Then
C# = 'on going study.....
-
Aug 18th, 2009, 05:48 AM
#6
Re: Create Databse in MySQL
Just replace the
Code:
CREATE DATABASE transaction;
by
Code:
CREATE DATABASE IF NOT EXISTS transaction;
Just to know, i don't know if you'll have problems with that name... to prevent why not add a prefix like dbTransaction...
Rate People That Helped You
Mark Thread Resolved When Resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|