task

DATA - option 1

connecting to a mySql database

[previously - how to article]

  1. [00:00] CREATE new project
    1. ] or use an existing project
  2. [00:00] Open Web.Config for the project
    1. ] and include the ConnectionStrings after configuration/appsettings just before system.web
    2. x] ADDed NEW conn string for your db (ex sospep public * NOTE sql provider )
  3. [00:00] create a view -
    1. x] for displaying the model, remember @model statement = yourProject.Models.Location
  4. [00:00] create a controller -
    1. x] passes the model data to the view
    2. x] Location myLocation = new Location();
    3. x] method Index(){return View(myLocation);}
  5. >[00:00] create a model -
    1. ] a class that contains all of the properties and methods of a given data entity, example Location
    2. ] uses db request(s) to populate instance of class
    3. ] need connection, command and reader objects to execute the command and process the returned data
  6. [00:00] ADD a REFERENCE to project
    1. x] REFERENCE =  mysql (6.9.4), *] not listed, use search on mysql
  7. [00:00] ADD a using statement to /Controller
    1. x] using guideMVC.Models
  8. [00:00] PRB EDIT example GetConnection() method
    1. ] SET connection name to mine, not example
  9. [****] SUCCESS
    1. ] we are pulling a record from the designated db, returning it to a view and displaying to on the page

[currently]

  1. [00:00] NEW task IN
    1. x] DATA-decision -

[next]

  1. ] NEXT
    1. ] multiple records
    2. ] connection object should be centralized

 

 


  1. [your DATA decision]
    1. ] chances are your going to be working with some form of data and the need to persist(store) that data. There are a couple of main DATA scenarios to consider  
    2. ] OPTION 1 - using an existing DB - commando - aka getting data out of and putting it back into an existing SQL database.  
    3. ] OPTION 2 - using an existing DB wih EF db first -
    4. ] OPTION 3 - creating a new DB for the project using EF code first -
  2. ] DATA OPTION 1 - asp.net MVC - connect to an existing db (mysql)
    1. ] http://www.codeproject.com/Articles/822392/Connecting-to-MySQL-from-ASP-NET-MVC-using-Visual 
    2. ] https://www.devart.com/dotconnect/mysql/articles/tutorial_ef.html 
    3. ] http://blog.jongallant.com/2013/04/mysql-aspnet-mvc-entity-framework.html 
  3. ] DATA OPTION 2
    1. ]
  4. ] DATA OPTION 3
    1. ] http://www.asp.net/mvc/overview/getting-started/database-first-development/setting-up-database 
    2. ] http://www.asp.net/mvc/overview/getting-started/database-first-development/creating-the-web-application

 


] tutorial - example

> tutorial - http://dev.mysql.com/doc/connector-net/en/connector-net-visual-studio-mvc-project-wizard-usage.html 

http://docs.oracle.com/cd/E17952_01/connector-net-en/connector-net-programming-mysqlcommand.html

https://msdn.microsoft.com/en-us/library/System.Data.SqlClient(v=vs.110).aspx 

http://stackoverflow.com/questions/12181428/asp-net-mvc-4-ef5-with-mysql  

http://stackoverflow.com/questions/2865454/can-we-build-asp-net-mvc-based-on-mysql-database

] docs - classes

https://msdn.microsoft.com/en-us/library/ms178359(v=vs.110).aspx - System.Data.SqlClient

https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand(v=vs.110).aspx - System.Data.SqlClient.SqlCommand

https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader(v=vs.110).aspx - sqlDataReader

https://msdn.microsoft.com/en-us/library/gg416515(v=vs.108) asp.net MVC 4

] g q = asp.net mvc mysql example

EF Reverse POCO generator

https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838?SRC=VSIDE - generate classes from db tables

] mysql wizard VS -mysql + VS 

https://www.youtube.com/watch?v=EulQWH3Z9AU 

 https://blogs.oracle.com/MySqlOnWindows/entry/howto_using_mysql_for_visual 

 

 

Details Photos Edit more

Details

ID: 5375

NAME: CREATE-article

DESCRIPTION: asp.net MVC - MySQL - getting data from a MySQL db into your msft asp.net MVC project

START DATE TIME: 2015-07-16 16:54:27

EST DURATION: 01:00:00

END DATE TIME: 2015-07-16 17:54:27

STATUS: To-Do

PRIORITY: -5

OWNER ID: 1

Content Photos Edit more

photos

photos for this task

actions

Agenda Email task SMS task Priorities