基本信息
源码名称:sql语句生成源码
源码大小:0.20M
文件格式:.rar
开发语言:C#
更新时间:2018-11-14
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 3 元×
微信扫码支付:3 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mid_Autumn_Festilval
{
public partial class Form1 : Form
{
public ComboBox cbxX = new ComboBox();
public TextBox DataName=new TextBox();
public TextBox GetData=new TextBox();
public Button OK = new Button();
Dictionary<string, string> sqlp = new Dictionary<string, string>();
List<string> text = new List<string>();
public Form1()
{
InitializeComponent();
//初始化
this.Opacity = 0.5;//初始化皮肤透明度为百分之50
this.Text = "sql语句生成器";
//创建一个控件
Label lal = new Label();
//位置
lal.Location = new Point(100, 90);
lal.Size = new Size(77,22);
lal.Text = "选择语句:";
this.Controls.Add(lal);
//创建下拉列表框
cbxX.Location = new Point(200,90);
this.Controls.Add(cbxX);
//输入表名
DataName.Location = new Point(200, 150);
//获取sql语句
GetData.Location = new Point(100, 200);
GetData.Size = new Size(444,199);
OK.Location = new Point(200, 255);
OK.MouseClick = ok_Click;
OK.Text = "确定生成";
this.Controls.Add(OK);
this.Controls.Add(DataName);
this.Controls.Add(GetData);
text.Add("添加");
text.Add("修改");
text.Add("删除");
text.Add("查找");
sqlp.Add("添加", "INSERT ");
sqlp.Add("修改", "UPDATE");
sqlp.Add("删除", "DELECTE ");
sqlp.Add("查找", "SELECTE ");
cbxX.DataSource = text;
}
private void Form1_Load(object sender, EventArgs e)
{
//点击数据
}
private void ok_Click(object sender, EventArgs e)
{
if(DataName.Text.Trim()!="")
{
foreach (var item in text)
{
//MessageBox.Show(item);
if (cbxX.Text == item)
{
foreach (var item2 in sqlp)
{
if (item == item2.Key)
{
//
if(item2.Key=="添加")
{
GetData.Text = item2.Value "INTO VALUES(列名) " DataName.Text " VALUES(值)";
}
if (item2.Key == "修改")
{
GetData.Text = item2.Value " " DataName.Text " SET 改的字段=‘’ WHERE ID=行数id";
}
if (item2.Key == "删除")
{
GetData.Text = item2.Value " * FROM " DataName.Text " WHERE ID = 行数id";
}
if (item2.Key == "查找")
{
GetData.Text = item2.Value "* FROM " DataName.Text;
}
}
}
}
}
}
else
{
MessageBox.Show("表名不能为空");
}
}
}
}