* mysql for visual studio 설치 : mysql-for-visualstudio-1.2.6.msi

http://dev.mysql.com/downloads/windows/visualstudio/

 

커넥터다운 설치
https://www.mysql.com/products/connector/

 

 

* 서버탐색기에 추가

 

* 데이터 모델 추가

 CREATE TABLE websites
( website_id INT(11) NOT NULL AUTO_INCREMENT,
  website_name VARCHAR(25) NOT NULL,
  server_name VARCHAR(20),
  creation_date DATE,
  CONSTRAINT websites_pk PRIMARY KEY (website_id)
);

 

 

* Entity Data Insert  

testEntities1 context = new testEntities1();

int maxID = 0;

var dataList = context.websites.OrderByDescending(c => c.website_id).FirstOrDefault();

if (dataList != null) maxID = dataList.website_id + 1;

 

websites testData = new websites();

testData.website_id = maxID;

testData.website_name = "Test" + maxID;

testData.server_name = "Server" + maxID;

 

context.websites.Add(testData);

context.SaveChanges();

 

* MySqlConnection 을 이용해 Data 가져오기
 

string cs = @"server=localhost;userid=root;

password=1110;database=test";

 

MySqlConnection conn = null;

DataSet ds = new DataSet();

conn = new MySqlConnection(cs);

conn.Open();

 

string stm = "SELECT * FROM websites";

MySqlDataAdapter da = new MySqlDataAdapter(stm, conn);

 

da.Fill(ds, "Table");

//MySqlCommand cmd = new MySqlCommand(stm, conn);

//rdr = cmd.ExecuteReader();

 

 

 

'DB' 카테고리의 다른 글

(SQLITE) Tool  (0) 2017.04.17
(SQLITE) Setup  (0) 2017.04.17
(Maria) Visual Studio 에서 사용하기  (0) 2017.04.15
(Maria) Tool 설치 (HeidiSQL)  (0) 2017.04.15
(Maria) Setup  (0) 2017.04.15
(MSSQL) 테이블 명, 컬럼명, 컬럼 순서, 컬럼타입 등 전체 보기  (0) 2017.04.13

+ Recent posts