By Sergey Skudaev
Here you find an example of using Visual Basic for Application (VBA) to connect Excell to MySQL. Also you will learn how to create table in MySQL and how to write SQL query.
First you must to install MySQL ODBC driver in PC where MS Excel is installed. It may be the same PC where your web server is running or PC connected to Web server machine. Follow the link to download MySQL ODBC driver:
Use http:// dev.mysql.com/ downloads/connector /odbc/3.51.html link.
Use http:// dev.mysql.com/ doc/mysql/en/ odbc-connector.html link to find instruction for Installation
Create in MySQL a table from Data Model and Database free tutorial.
create table credit_card( cardid INT NOT NULL AUTO_INCREMENT, name varchar(20), type varchar(20), expired date, card_num INT, credit float, phone varchar(12), address varchar(100), city varchar(20), state varchar(2), zip varchar(10), PRIMARY KEY(cardid) );
Read One hour MySQL tutorial to learn how to use command prompt to start MySQL server and client, and create database and table
Open command prompt and go to MySQL user interface.
Type: Create database credit; and Press enter. Database is created. Hover mouse over thumbnail to see large picture
Use this picture as example.
To select database, type use credit; Database changes.
Create credit_card table in credit database. Copy script for credit_card table, paste it in notepad and save file as card.sql in C:\mysql\bin directory. Then type source card.sql and press enter. See picture below. Table created.
Fill the credit_card table with data.
Open notepad and paste in it the insert query for three records:
Insert into credit_card (cardid, name, type, expired, card_num, credit, phone, address, city, state, zip) values (0, 'CHASE', 'Visa', '2006-01-01', 123456789, 20000.00, '123-123-1234', '12 West 13th Street', 'New York', 'NY', '12345-4321'); Insert into credit_card (cardid, name,type, expired, card_num, credit, phone, address, city, state, zip) values (0, 'Bank One', 'MasterCard', '2006-01-07', 987654321, 10000.00, '123-123-9876', '16 West 17th Street', 'New York', 'NY', '12345-4321'); Insert into credit_card (cardid, name, type, expired, card_num, credit, phone, address, city, state, zip) values (0, 'Chase Platinum', 'MasterCard', '2006-09-07', 999996789, 15000.00, '123-876-9876', '19 West 19th Street', 'New York', 'NY', '12999-4321');
Save file in MySQL\bin directory as insert.sql.
To insert records, type source insert.sql as in example below
Record is inserted in db. To continue go to the next page: >>Part 2>>
Our dog needs urgent surgery, and the cost is overwhelming.
Any help, big or small, would mean the world to us. Thank you for supporting Oscar on his journey to recovery!
Oscar Story.
Oscar wasn’t just any puppy—he was a gift from a mother who trusted us with her smallest one.
For five years, my wife worked at the Indian Medical Center in Arizona, deep in Navajo Nation. Near her clinic, she often saw a homeless dog wandering the area. Over time, she began feeding her, and the dog grew fond of her. Then, one day, that same dog brought her newborn puppies to my wife—as if proudly showing them off.
Among them was the smallest, most delicate pup. My wife couldn’t resist. She brought him home, and we named him Oscar.
Oscar thrived in the house provided by the medical center, enjoying the big backyard where he lived. I built him a sturdy wooden doghouse, and we often took him on walks along the Window Rock Trail. He became our adventure companion, making the vast desert feel like home.
After my wife’s contract ended, we moved back to Florida, bringing Oscar with us. He adjusted to his new surroundings, but he never lost his adventurous spirit.
Now, Oscar faces a tough challenge—he needs urgent surgery, and the cost is overwhelming. We want to give him the best care possible, just as he’s given us years of joy and loyalty.
Any help, big or small, would mean the world to us. Thank you for supporting Oscar on his journey to recovery!