| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
142 バイト除去 、 2020年12月30日 (水) 14:16
=====DML(create table)=====
<pre>
public void CreateTable(string host, string database, string user, string password) { // create database jra default character set utf8using MySql.Data.MySqlClient; // create user 'jra'@'localhost' identified by 'new password'; // create user 'jra'@'%' identified by 'new password'using System.Data; // grant all privileges on *using System.* to 'jra'@'%' with grant optionDiagnostics;
var conInfo = $"Database=public void CreateTable(string host, string database, string user, string password){ // create database jradefault character set utf8;Data Source=192.168.0.2;User Id= // create user 'jra;Password='@'localhost' identified by 'new password; pooling = false; convert zero datetime=True"'; using (var conn = // create user 'jra'@'%' identified by 'new MySqlConnection(conInfo)) {password'; conn // grant all privileges on *.Open()* to 'jra'@'%' with grant option;
var conInfo = $"Database=jra;Data Source=192.168.0.2;User Id=jra;Password=password; pooling = false; convert zero datetime=True"; using (var conn = new MySqlConnection(conInfo)) { conn.Open();  var createTable = @"
create table jra_data (
rec_spec varchar(2) not null, rec_key varchar(100) not null, make_date varchar(10) not null, data_type varchar(1) not null, data mediumtext, primary key(rec_spec, rec_key)
)";
var cmd = new MySqlCommand(createTable); cmd.Connection = conn; cmd.ExecuteNonQuery(); } }
</pre>

案内メニュー