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.
Printable View
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.
Inside the IDE? Or when running the application? Or with some other tool?
I want to create a function that check and create a database if is not present in my localhost.
If you want to only check if the database you can do this:
If you want to create the DB if the DB not existsCode:SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'Name'
Code:CREATE DATABASE IF NOT EXISTS Name;
btw it is my sql script i want to create if the database is not exist:
is that possible to execute that in my form? I am using MySQL Server 5.0Code: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;
Just replace the
byCode:CREATE DATABASE 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...Code:CREATE DATABASE IF NOT EXISTS transaction;