📄 updatesuper.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
namespace _3Dmanager
{
/// <summary>
/// Updatesuper 的摘要说明。
/// </summary>
public class Updatesuper : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private string name=null;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Updatesuper()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label2
//
this.label2.Location = new System.Drawing.Point(32, 80);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 16);
this.label2.TabIndex = 3;
this.label2.Text = "地址:";
//
// textBox2
//
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox2.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textBox2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
this.textBox2.Location = new System.Drawing.Point(96, 72);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(192, 26);
this.textBox2.TabIndex = 4;
this.textBox2.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(312, 80);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 16);
this.label3.TabIndex = 5;
this.label3.Text = "提供类别:";
//
// comboBox1
//
this.comboBox1.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.comboBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
this.comboBox1.Location = new System.Drawing.Point(384, 72);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(144, 24);
this.comboBox1.TabIndex = 6;
this.comboBox1.Text = "请选择";
//
// label4
//
this.label4.Location = new System.Drawing.Point(312, 128);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 16);
this.label4.TabIndex = 7;
this.label4.Text = "电话:";
//
// textBox3
//
this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox3.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textBox3.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
this.textBox3.Location = new System.Drawing.Point(384, 120);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(144, 26);
this.textBox3.TabIndex = 8;
this.textBox3.Text = "";
//
// label5
//
this.label5.Location = new System.Drawing.Point(24, 128);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 16);
this.label5.TabIndex = 9;
this.label5.Text = "负责人:";
//
// textBox4
//
this.textBox4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox4.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textBox4.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
this.textBox4.Location = new System.Drawing.Point(96, 120);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(192, 26);
this.textBox4.TabIndex = 10;
this.textBox4.Text = "";
//
// label6
//
this.label6.Location = new System.Drawing.Point(32, 176);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(40, 16);
this.label6.TabIndex = 11;
this.label6.Text = "简介:";
//
// richTextBox1
//
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.richTextBox1.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.richTextBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
this.richTextBox1.Location = new System.Drawing.Point(96, 176);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(416, 88);
this.richTextBox1.TabIndex = 12;
this.richTextBox1.Text = "";
//
// button2
//
this.button2.Location = new System.Drawing.Point(264, 288);
this.button2.Name = "button2";
this.button2.TabIndex = 13;
this.button2.Text = "修改";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(360, 288);
this.button3.Name = "button3";
this.button3.TabIndex = 14;
this.button3.Text = "取消";
//
// button4
//
this.button4.Location = new System.Drawing.Point(456, 288);
this.button4.Name = "button4";
this.button4.TabIndex = 15;
this.button4.Text = "退出";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(520, 240);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(40, 23);
this.button5.TabIndex = 16;
this.button5.Text = "...";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(24, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(488, 64);
this.groupBox1.TabIndex = 17;
this.groupBox1.TabStop = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(360, 24);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(96, 24);
this.button1.TabIndex = 5;
this.button1.Text = "查看信息";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.textBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(64)), ((System.Byte)(0)));
this.textBox1.Location = new System.Drawing.Point(99, 24);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(184, 26);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(35, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 16);
this.label1.TabIndex = 3;
this.label1.Text = "商家名称:";
//
// Updatesuper
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(576, 324);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.label6);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label4);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Name = "Updatesuper";
this.Text = "修改商家";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void button4_Click(object sender, System.EventArgs e)
{
this.Dispose();
}
private void button1_Click(object sender, System.EventArgs e)
{
name=textBox1.Text.Trim();
string address=textBox2.Text.Trim();
string type=comboBox1.Text;
string fzr=textBox3.Text.Trim();
string phone=textBox4.Text.Trim();
if(name.Equals(""))
{
MessageBox.Show("请填写商家名称!");
textBox1.Focus();
return;
}
OleDbConnection con=_3DLib.DataBaseCon.GetCon();
OleDbCommand cmd=new OleDbCommand();
cmd.Connection=con;
con.Open();
cmd.CommandText="select * from 提供商 where 名称='"+name+"'";
OleDbDataReader odr;
odr=cmd.ExecuteReader();
while(odr.Read())
{
//id=odr.GetInt32(0);
textBox2.Text=odr.GetString(4);
comboBox1.Text=odr.GetString(2);
textBox3.Text=odr.GetString(5);
textBox4.Text=odr.GetString(3);
this.richTextBox1.Text=odr.GetString(6);
}
con.Close();
}
private void button2_Click(object sender, System.EventArgs e)
{
string address=textBox2.Text.Trim();
string type=comboBox1.Text;
string fzr=textBox4.Text.Trim();
string phone=textBox3.Text.Trim();
string bz=richTextBox1.Text.Trim();
string rs1,rs2,rs3,rs4,rs5;
rs1=_3DLib.UpdateInfo.updateOneIfoCom("提供商",address,"地址",name);
rs2=_3DLib.UpdateInfo.updateOneIfoCom("提供商",type,"提供类别",name);
rs3=_3DLib.UpdateInfo.updateOneIfoCom("提供商",fzr,"联系人",name);
rs4=_3DLib.UpdateInfo.updateOneIfoCom("提供商",phone,"电话",name);
rs5=_3DLib.UpdateInfo.updateOneIfoCom("提供商",bz,"备注",name);
if(rs1.Equals("OK")&&rs2.Equals("OK")&&rs3.Equals("OK")&&rs4.Equals("OK")&&rs5.Equals("OK"))
{
MessageBox.Show("修改成功!");
}
else MessageBox.Show("修改失败!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -