资源简介
平时用得到的工具,源码也提供了!不能生成文件,只能生成代码,没有美工只满足实用,可以自己改一下。
代码片段和文件信息
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MYSQL实体类生成
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
string connectStr = “server=“ + textBox1.Text + “;port=3306;user=“ + textBox2.Text + “;password=“ + textBox3.Text + “;“;
string sqlstr = “select TABLE_SCHEMA from information_schema.tables where table_type=‘base TABLE‘ GROUP BY ‘TABLE_SCHEMA‘;“; //SQL语句
DataSet Ds = SQLHelper.GetDataSet(connectStrsqlstr CommandType.Text null);
comboBox1.DataSource = Ds.Tables[0];
comboBox1.DisplayMember = “TABLE_SCHEMA“;
comboBox1.ValueMember = “TABLE_SCHEMA“;
}
private void comboBox1_SelectedIndexChanged(object sender EventArgs e)
{
string connectStr = “server=“ + textBox1.Text + “;port=3306;user=“ + textBox2.Text + “;password=“ + textBox3.Text + “;“;
string sqlstr = “select table_nametable_rows from information_schema.tables where table_schema=‘“ + comboBox1 .Text+ “‘ and table_type=‘base table‘;“; //SQL语句
DataSet Ds = SQLHelper.GetDataSet(connectStr sqlstr CommandType.Text null);
comboBox2.DataSource = Ds.Tables[0];
comboBox2.DisplayMember = “table_name“;
comboBox2.ValueMember = “table_name“;
}
private void comboBox2_SelectedIndexChanged(object sender EventArgs e)
{
richTextBox1.Text = ““;
richTextBox2.Text = ““;
richTextBox3.Text = ““;
StringBuilder sb = new StringBuilder();
string connectStr = “server=“ + textBox1.Text + “;port=3306;user=“ + textBox2.Text + “;password=“ + textBox3.Text + “;“;
string sqlstr = “select column_nameORDINAL_POSITIONIS_NULLABLEDATA_TYPECOLUMN_COMMENT from information_schema.columns where table_schema=‘“ + comboBox1.Text + “‘ and table_name=‘“ + comboBox2.Text + “‘;“; //SQL语句
MySqlDataReader dr = SQLHelper.ExecuteReader(connectStr sqlstr CommandType.Text null);
while (dr.Read()) {
String[] sp = dr[“column_name“].ToString().Split(‘_‘);
richTextBox1.AppendText(sp[sp.Length-1] + “\r\n“);
String dx = sp[sp.Length - 1].Substring(0 1).ToUpper() + sp[sp.Length - 1].Substring(1);
if (dr[“DATA_TYPE“].ToString() == “int“)
{
richTextBox2.AppendText(“private int “ + sp[sp.Length - 1] + “=0;//“ + dr[“COLUMN_COMMENT“] + “\r\n“);
String ass = “public int “ + dx + “\n“ +
“{\n“ +
相关资源
- mysql数据库驱动8.0.12版本
- mha4mysql-0.56-0.el6
- mysql_5.6.24_winx64
- MYSQL作业提交作业批改系统.zip
- Maven搭建Spring+Mybatis+MySql
- 成语首尾字用于成语接龙.sql
- MySQL中文手册api帮助文档
- linux_mysql5.1.66x86_64.zip
- oracle 到mysql转换工具
- 数据库原理实验指导书Mysql
- mysql 5.6 绿色精简版 5Mb
- mysql Premium 破解
- 深入浅出MySQL第二版本pdf
- 深入浅出MySQL.pdf
- 深入浅出mysql全文
- 全球国家及地区库,采集自腾讯QQ国内
- mysql操作练习的表数据
- 免费的Navicat11全系列注册机Navicat fo
- Navicat For MySql 8.0.20 简体中文版(含破
- navicat for mysql v 11.1.13破解工具
- mysql数据库5.6连接包
- Navicat for MySQL注册机 绿色版
- 旅游管理系统数据库
- 易语言MySQL注册登录源码
- 传智播客mysql的sql优化
- msvcr120.dll 32位和64位
- mysql5.7驱动.rar
- mysql innodb恢复数据工具.rar
- 易语言Mysql线程池2.0模块源码
- 数据库宾馆管理系统Mysql
评论
共有 条评论