Archive for the ‘mysql’ Category

Invalid token ‘void’ in class, struct, or interface member declaration

EDIT :

After finishing this post I ran into all sorts of other strange issues and restarted using a Web Appliction instead of a plain old Website.  Between IntelliSense not showing any classes, to project reference issues, I couldn’t figured it out in time.  I’m sure there’s a way, I just had to move on.  So maybe this ramble below will be helpful for someone.

EF

Just ran into something quirky with Visual Studio 2008’s new ADO.NET Entity Data Model wizard.  While working on an ASP.NET 3.5 website ( not a codebehind web application ) I was trying to get the ADO.NET Entity Data model wizard to work with MySQL and ran into a probable Visual Studio bug.  To sum up the issue, if you are going to add a new edmx to your project, do NOT save it to the App_Code folder initially.  Put it in your root folder, compile your project, then move the edmx where you’d like.

Assuming you’ve already created your ASP.NET Website project, here’s how you reproduce this issue.

Right click your project and left click ‘Add New Item’

Right click your project, left click Add New Item

Add New Item

Select ADO.NET Entity Data Model, name it, select your language of preference

New ADO.NET Entity Data Model

ADO.NET Entity Data Model

Click Yes to the ‘Store in App_Code’ prompt

Place your edmx in App_Code folder

Place file in 'App_Code' folder

Complete the new Entity Data Model wizard

See this tutorial if you have not done this before

Compile project after completing wizard

Invalid token 'void' in class, struct, or interface member declaration

Invalid token 'void' in class, struct, or interface member declaration

At this point your project should have a new.edmx file located inside of the App_Code folder, but the project won’t build without failing.  If you are stuck in this predicament, follow this workaround.

Move .edmx to root folder and rebuild

Move edmx to root and recompile, no errors!

WORKAROUND : move edmx to root folder, then recompile

After moving your edmx file to the root folder you should be able to compile without problem.  Assuming this solves your problem, you should be able to move your edmx file to the App_Code folder without problem.  Seems like an initial compile problem.

Copy a MySQL database to your local MySQL machine

Here’s one way to copy a MySQL database from one server to another using phpMyAdmin, and the MySQL command line client.

Requirements :

  • MySQL 5.x installed on your local machine
  • MySQL command line client on your local machine
  • Access to phpMyAdmin on your source MySQL machine

Assumptions:

  • You have access to the MySQL command line client.
  • You have the root password for your local MySQL instance
  • You are comfortable using phpMyAdmin and MySQL command line client

Instructions:

  1. Log into phpMyAdmin on your source MySQL machine.
  2. Click the Export link on the lower part of the home page.
  3. Select your database in the ‘Export’ box on the left.
  4. Make sure SQL is selected under the database box.
  5. In the ‘Options’ box on the right, make sure Structure and Data are selected.
  6. Make sure to check ‘Add DROP TABLE / DROP VIEW’ as well.
  7. Towards the bottom, check the box next to ‘Save as file’. This will be the file we import later.
  8. Click the GO button, and your browser should prompt you to download your SQL file. *Make note of where you saved your exported sql file. I saved mine to d:\downloads\import.sql because it’s an easy path to use later.
  9. Open your local MySQL Command Line Client. ( From MySql Program menu or type “mysql -u root -p” in the run dialog box ).
  10. Enter your root password when prompted.
  11. Import your database by running this command “mysql \. d:\downloads\import.sql“. Be sure to adjust the path to match where you saved your sql file from step 8.
  12. Now you should see your database listed when you run the command “show databases;

 

Here are instructions for doing the same thing on OS X

  1. Follow steps 1 through 8 above to created your sql export file
  2. Connect to mysql “/usr/local/mysql/bin/mysql -u root -p”
  3. {enter root password}
  4. If it’s not already created, created your databse “create database {your db name};”
  5. Select your database “user {your db name};”
  6. “mysql \. /users/ericfickes/Downloads/mydbfile.sql”

Be sure to adjust the paths listed to match your MySQL install, and the location where you downloaded the sql file.