Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Buat kelas C# berdasarkan tabel MySQL

mungkin Anda membutuhkan sesuatu seperti ini:

select 'my_table' into @table; #table name
select 'my_database' into @schema; #database name
select concat('public class ',@table,'{') union
select concat('public ',tps.dest,' ',column_name,'{get;set;}') from  information_schema.columns c
join( #datatypes mapping
select 'char' as orign ,'string' as dest union all
select 'varchar' ,'string' union all
select 'longtext' ,'string' union all
select 'datetime' ,'DateTime?' union all
select 'text' ,'string' union all
select 'bit' ,'int?' union all
select 'bigint' ,'int?' union all
select 'int' ,'int?' union all
select 'double' ,'double?' union all
select 'decimal' ,'double?' union all
select 'date' ,'DateTime?' union all
select 'tinyint' ,'bool?'
) tps on c.data_type like tps.orign
where [email protected] and [email protected] union
select '}';


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Cara mengatur max_connections di MySQL Secara Terprogram

  2. Bisakah saya menggunakan lapisan basis data Laravel secara mandiri?

  3. MONTHNAME() Contoh – MySQL

  4. Cara memasukkan data ke mysql menggunakan Java

  5. #1242 - Subquery mengembalikan lebih dari 1 baris - mysql