c#中对comboBox.Text的值进行条件判断,语句怎么写?

mgs834 2017-07-26 10:33:40
我的查询界面中放了一个comboBox,我想对这个comboBox1.Text作一个简单的判断,比如

if comboBox1.Text不为空,且comboBox1.Text = '客供品仓' //这一句在C#中要怎么写啊?
执行我的SQL语句……。
else
执行我的SQL语句……。
end
...全文
1975 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
吉普赛的歌 2017-07-26
  • 打赏
  • 举报
回复
if( comboBox1.Text.Trim()=="客供品仓" ){
    //执行我的SQL语句……。
}
else{ 
    //执行我的SQL语句……。
}
你那个判断文本框是否空没必要, 可以去掉。 文本框你不进行任何操作都不可能为null。
Haou2020 2017-07-26
  • 打赏
  • 举报
回复

if(comboBox1.Text == "客供品仓")
{
}
已经判断是否为客供品仓了 还需要判断是否为空么?
exception92 2017-07-26
  • 打赏
  • 举报
回复
类似:
string cboText = comboBox1.Text.Trim();
if(cboText!="" && cboText=="客供品仓")
{
    //     SQL语句……。
} 
else 
{
   //     SQL语句……。
}
xdashewan 2017-07-26
  • 打赏
  • 举报
回复
判断空if(!string.IsNullOrEmpty(comboBox1.Text)) 等于if(“客供品仓”.Equals(comboBox1.Text))
  • 打赏
  • 举报
回复
if (comboBox1.Text !="" && comboBox1.Text == '客供品仓' ) { 执行我的SQL语句……。 }else { 执行我的SQL语句……。 }
/* API精灵 FOR C# 开始设计日期 2004.03.06 设计目的:简单快速对C#使用的API函数进行查询,并给出调用代码 设计进度: 2004.03.09 完成对的查询功能,包括 代码调用,文注释,所需的DLL库,与C#函数对应关系 2004.03.10 0:48:52 完成了用StringBuilder数组对原ComboBox的替换,可以使程序不用从新读取数据库就可以刷新修改后的信息! 2004.03.10 18:00:00 完成了用ArrayList对StringBuilder数组的替换节省2M内存 2004.03.11 21:10:15 完成滚动字幕的设置,启用了一个TIMER控件,然后设置时间,删除字符串的第一个字母已达到滚动效果! 2004.03.11 22:02:00 改正更新时出现空出错问题,新填函数isnull 2004.03.12 13:22:08 完成关键字高亮显示 高亮显示函数 mykeywords 2004.03.12 22:08:20 加强了高亮显示函数 mykeywords的功能,使其能识别不同的关键字并显示不同的颜色 2004.03.14 01:40:00 完成对CONST的查询,并且增加了 mykeywords1函数,使其关键字显示性能提高 2004.03.14 13:12:00 添加了提示信息,提示信息设置在函数 mytips() 2004.03.15 21:51:20 更改数据库和WINAPI.TXT路径为程序运行路径 2004.03.15 22:31:50 添加了鼠标右键信息 2004.03.15 23.23:30 添加了数据库密码 2004.03.16 23:24:30 添加了版权信息以及相应提示 */ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Data.OleDb; using System.Runtime.InteropServices; using System.IO; namespace API精灵 { /// /// Form1 的摘要说明。 /// 这个版本没有使用oleDbDataAdapter+DataSet对数据进行存取,而是使用的OleDbCommand +OleDbDataReader 的形式。 /// 主要是想试验一下不用oleDbDataAdapter+DataSet的数据存取速度。 /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Button button1; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.Button button4; private System.Windows.Forms.TextBox mysearch; private System.Windows.Forms.ListBox tiplist; private System.Windows.Forms.ComboBox select_type; private System.Windows.Forms.TextBox dlltext; /// /// 必需的设计器变量。 /// //自定义变量 private ArrayList fundll = new ArrayList();//保存读取出来的DLL内容 private ArrayList funtips = new ArrayList();//保存读取出来的文提示信息 private ArrayList funcode = new ArrayList();//保存读取出来的C#调用代码 private ArrayList funmat = new ArrayList();//保存读取出来的C#对应函数 private ArrayList funwin9x = new ArrayList();//保存读取出来的WIN9X private ArrayList funwin2k = new ArrayList();//保存读取出来的WIN2K private int nowselect = 0; private string oldscoll_text; private int nowtypeselect = 0; private string nowpath = @System.Environment.CurrentDirectory+@"\"; private string dbpassword = "ling_feng_work"; public string myConnstr; public OleDbConnection myconn ;//创建一个新连接 private string mysql ;//查询语句 private string sql_update; private System.Windows.Forms.RichTextBox tipsmemo; private System.Windows.Forms.TextBox mat_text; private OleDbCommand mycommand = new OleDbCommand(); private System.Windows.Forms.RichTextBox codememo; private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.CheckBox win9x; private System.Windows.Forms.GroupBox groupBox5; private System.Windows.Forms.CheckBox win2k; private System.Windows.Forms.CheckBox e_add; private System.Windows.Forms.CheckBox e_modify; private System.Windows.Forms.Button b_modify; private System.Windows.Forms.Button b_add; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ContextMenu mypop; private System.Windows.Forms.MenuItem menuItem1; private System.ComponentModel.IContainer components; public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// /// 清理所有正在使用的资源。 /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.button1 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.tiplist = new System.Windows.Forms.ListBox(); this.select_type = new System.Windows.Forms.ComboBox(); this.mat_text = new System.Windows.Forms.TextBox(); this.mysearch = new System.Windows.Forms.TextBox(); this.dlltext = new System.Windows.Forms.TextBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.tipsmemo = new System.Windows.Forms.RichTextBox(); this.mypop = new System.Windows.Forms.ContextMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.codememo = new System.Windows.Forms.RichTextBox(); this.b_modify = new System.Windows.Forms.Button(); this.b_add = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.win2k = new System.Windows.Forms.CheckBox(); this.win9x = new System.Windows.Forms.CheckBox(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.e_add = new System.Windows.Forms.CheckBox(); this.e_modify = new System.Windows.Forms.CheckBox(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox5.SuspendLayout(); this.SuspendLayout(); // // button1 // this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button1.Location = new System.Drawing.Point(224, 395); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 24); this.button1.TabIndex = 10; this.button1.Text = "关 于"; this.button1.Click += new System.EventHandler(this.button1_Click); // // groupBox1 // this.groupBox1.Controls.Add(this.tiplist); this.groupBox1.Controls.Add(this.select_type); this.groupBox1.Controls.Add(this.mat_text); this.groupBox1.Controls.Add(this.mysearch); this.groupBox1.Controls.Add(this.dlltext); this.groupBox1.Location = new System.Drawing.Point(8, 8); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(200, 168); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "API查询"; // // tiplist // this.tiplist.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tiplist.ItemHeight = 12; this.tiplist.Location = new System.Drawing.Point(8, 43); this.tiplist.Name = "tiplist"; this.tiplist.Size = new System.Drawing.Size(184, 110); this.tiplist.TabIndex = 1; this.tiplist.Visible = false; this.tiplist.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tiplist_KeyDown); this.tiplist.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tiplist_KeyPress); this.tiplist.DoubleClick += new System.EventHandler(this.tiplist_DoubleClick); this.tiplist.MouseUp += new System.Windows.Forms.MouseEventHandler(this.tiplist_MouseUp); this.tiplist.MouseLeave += new System.EventHandler(this.tiplist_MouseLeave); this.tiplist.SelectedIndexChanged += new System.EventHandler(this.tiplist_SelectedIndexChanged); // // select_type // this.select_type.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.select_type.Items.AddRange(new object[] { "API函数查询", "常量定义查询"}); this.select_type.Location = new System.Drawing.Point(8, 61); this.select_type.Name = "select_type"; this.select_type.Size = new System.Drawing.Size(184, 20); this.select_type.TabIndex = 2; this.select_type.SelectedIndexChanged += new System.EventHandler(this.select_type_SelectedIndexChanged); // // mat_text // this.mat_text.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.mat_text.Location = new System.Drawing.Point(8, 134); this.mat_text.Name = "mat_text"; this.mat_text.Size = new System.Drawing.Size(184, 21); this.mat_text.TabIndex = 4; this.mat_text.Text = "C#对应函数:"; this.mat_text.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mat_text_MouseDown); // // mysearch // this.mysearch.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.mysearch.Location = new System.Drawing.Point(8, 24); this.mysearch.Name = "mysearch"; this.mysearch.Size = new System.Drawing.Size(184, 21); this.mysearch.TabIndex = 0; this.mysearch.Text = ""; this.mysearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.mysearch_KeyDown); this.mysearch.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mysearch_MouseDown); this.mysearch.TextChanged += new System.EventHandler(this.mysearch_TextChanged); // // dlltext // this.dlltext.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.dlltext.Location = new System.Drawing.Point(8, 97); this.dlltext.Name = "dlltext"; this.dlltext.Size = new System.Drawing.Size(184, 21); this.dlltext.TabIndex = 3; this.dlltext.Text = ""; this.dlltext.TextChanged += new System.EventHandler(this.dlltext_TextChanged); // // groupBox2 // this.groupBox2.Controls.Add(this.tipsmemo); this.groupBox2.Location = new System.Drawing.Point(216, 8); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(200, 168); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = "函数注释"; // // tipsmemo // this.tipsmemo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tipsmemo.ContextMenu = this.mypop; this.tipsmemo.Location = new System.Drawing.Point(8, 16); this.tipsmemo.Name = "tipsmemo"; this.tipsmemo.Size = new System.Drawing.Size(184, 144); this.tipsmemo.TabIndex = 0; this.tipsmemo.Text = ""; this.tipsmemo.MouseEnter += new System.EventHandler(this.richTextBox1_MouseEnter); // // mypop // this.mypop.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1}); // // menuItem1 // this.menuItem1.Index = 0; this.menuItem1.Text = "复制信息"; this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); // // groupBox3 // this.groupBox3.Controls.Add(this.codememo); this.groupBox3.Location = new System.Drawing.Point(8, 221); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(408, 168); this.groupBox3.TabIndex = 3; this.groupBox3.TabStop = false; this.groupBox3.Text = "代码调用"; // // codememo // this.codememo.ContextMenu = this.mypop; this.codememo.Location = new System.Drawing.Point(8, 16); this.codememo.Name = "codememo"; this.codememo.Size = new System.Drawing.Size(392, 144); this.codememo.TabIndex = 0; this.codememo.Text = ""; this.codememo.TextChanged += new System.EventHandler(this.codememo_TextChanged); // // b_modify // this.b_modify.Enabled = false; this.b_modify.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.b_modify.Location = new System.Drawing.Point(120, 395); this.b_modify.Name = "b_modify"; this.b_modify.Size = new System.Drawing.Size(75, 24); this.b_modify.TabIndex = 4; this.b_modify.Text = "修改信息"; this.b_modify.Click += new System.EventHandler(this.button2_Click); // // b_add // this.b_add.Enabled = false; this.b_add.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.b_add.Location = new System.Drawing.Point(16, 395); this.b_add.Name = "b_add"; this.b_add.Size = new System.Drawing.Size(75, 24); this.b_add.TabIndex = 5; this.b_add.Text = "添加新项"; // // button4 // this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button4.Location = new System.Drawing.Point(328, 395); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(75, 24); this.button4.TabIndex = 6; this.button4.Text = "退 出"; this.button4.Click += new System.EventHandler(this.button4_Click); // // groupBox4 // this.groupBox4.Controls.Add(this.win2k); this.groupBox4.Controls.Add(this.win9x); this.groupBox4.Location = new System.Drawing.Point(8, 176); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(200, 40); this.groupBox4.TabIndex = 11; this.groupBox4.TabStop = false; // // win2k // this.win2k.Location = new System.Drawing.Point(104, 11); this.win2k.Name = "win2k"; this.win2k.Size = new System.Drawing.Size(80, 24); this.win2k.TabIndex = 1; this.win2k.Text = "支持win2k"; // // win9x // this.win9x.Location = new System.Drawing.Point(16, 11); this.win9x.Name = "win9x"; this.win9x.TabIndex = 0; this.win9x.Text = "支持win9x"; // // groupBox5 // this.groupBox5.Controls.Add(this.e_add); this.groupBox5.Controls.Add(this.e_modify); this.groupBox5.Location = new System.Drawing.Point(216, 176); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(200, 40); this.groupBox5.TabIndex = 12; this.groupBox5.TabStop = false; // // e_add // this.e_add.Location = new System.Drawing.Point(112, 10); this.e_add.Name = "e_add"; this.e_add.Size = new System.Drawing.Size(80, 24); this.e_add.TabIndex = 5; this.e_add.Text = "允许添加"; this.e_add.CheckedChanged += new System.EventHandler(this.e_add_CheckedChanged); // // e_modify // this.e_modify.Location = new System.Drawing.Point(16, 10); this.e_modify.Name = "e_modify"; this.e_modify.Size = new System.Drawing.Size(76, 24); this.e_modify.TabIndex = 4; this.e_modify.Text = "允许修改"; this.e_modify.CheckedChanged += new System.EventHandler(this.e_modify_CheckedChanged); // // timer1 // this.timer1.Interval = 500; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(424, 429); this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox4); this.Controls.Add(this.button4); this.Controls.Add(this.b_add); this.Controls.Add(this.b_modify); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox1); this.Controls.Add(this.button1); this.Controls.Add(this.groupBox2); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "API精灵FOR C#"; this.Load += new System.EventHandler(this.Form1_Load); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.groupBox4.ResumeLayout(false); this.groupBox5.ResumeLayout(false); this.ResumeLayout(false); } #endregion /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { Application.Run(new Form1()); } [DllImport("user32.dll", EntryPoint="ShowWindow")] public static extern int ShowWindow ( int hwnd, int nCmdShow ); private void button1_Click(object sender, System.EventArgs e) { AboutForm myabout = new AboutForm(); myabout.ShowDialog(); } /// /// 填mysearch的内容。 /// private void search_comp() { if (tiplist.SelectedIndex>-1) mysearch.Text = tiplist.SelectedItem.ToString(); tiplist.Visible = false ; mysearch.Select(); } /// /// 自动填提示内容。 /// private void autocomp() { if (tiplist.SelectedIndex>-1) try { if (this.nowtypeselect==0) //================查询函数 { this.nowselect = tiplist.SelectedIndex; dlltext.Text = fundll[tiplist.SelectedIndex].ToString();//else tipsmemo.Text = funtips[tiplist.SelectedIndex].ToString(); codememo.Text = funcode[tiplist.SelectedIndex].ToString(); mat_text.Text = funmat[tiplist.SelectedIndex].ToString(); this.oldscoll_text = mat_text.Text; if (funwin9x[tiplist.SelectedIndex].ToString()==("Yes")) win9x.Checked=true; else win9x.Checked=false; if (funwin2k[tiplist.SelectedIndex].ToString()==("Yes")) win2k.Checked=true; else win2k.Checked=false; //滚动文字 if (mat_text.TextLength>30) timer1.Enabled = true; else timer1.Enabled = false; } else { dlltext.Text = ""; tipsmemo.Text = ""; codememo.Text = ""; win9x.Checked = false; win2k.Checked = false; } //******************** if (this.nowtypeselect==1) { this.nowselect = tiplist.SelectedIndex; codememo.Text = funcode[tiplist.SelectedIndex].ToString(); } //******************** //================= } catch { dlltext.Text = "没有找到相应连接库"; tipsmemo.Text = "没有找到相应提示"; codememo.Text = "没有找到相应调用代码"; mat_text.Text = "没有找到相应C#函数"; } } // /// /// 手动释放一些内存。 /// private void mydisp() { tipsmemo.Clear(); codememo.Clear(); tiplist.Items.Clear(); // ===== fundll.Clear();//保存读取出来的DLL内容 funtips.Clear();//保存读取出来的文提示信息 funcode.Clear();//保存读取出来的C#调用代码 funmat.Clear();//保存读取出来的C#对应函数 funwin9x.Clear();//保存读取出来的WIN9X funwin2k.Clear();//保存读取出来的WIN2K } private void mysearch_TextChanged(object sender, System.EventArgs e) { tiplist.Visible = true ; //自动完成功能。 tiplist.SelectedIndex = (tiplist.FindString(mysearch.Text,-1)) ;//加上这句,保证TIPLIST跟着自动变化 nowselect = tiplist.SelectedIndex; autocomp(); //设置提示信息 mytips(); } private void mysearch_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if ((e.KeyCode == Keys.Down) || (e.KeyCode == Keys.Up)) tiplist.Focus(); if (e.KeyCode == Keys.Enter) { search_comp(); if (this.nowtypeselect==0) mykeyword(); if (this.nowtypeselect==1) mykeyword1(); } if (e.KeyCode == Keys.Escape) { tiplist.Visible = false ; } } private void tiplist_MouseLeave(object sender, System.EventArgs e) { } private void tiplist_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { } private void tiplist_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { this.search_comp(); if (this.nowtypeselect==0) mykeyword(); else mykeyword1(); } if (e.KeyCode == Keys.Escape) { tiplist.Visible = false ; } } private void tiplist_DoubleClick(object sender, System.EventArgs e) { this.search_comp(); if (this.nowtypeselect==0) mykeyword(); else mykeyword1(); } private void Form1_Load(object sender, System.EventArgs e) { //初始化数据库 initdatabase(); //MessageBox.Show(this,"欢迎使用 共享版\n 本版对使用功能上略有限制\n 且不提供数据库更新!\n 如想获得更多信息请与我联系。\n dong_teng@tom.com","提示",MessageBoxButtons.OK,MessageBoxIcon.Information); select_type.SelectedIndex = 0; AboutForm myabout = new AboutForm(); myabout.ShowDialog(); } // private void mytips() { //设置提示信息 if ((this.nowselect>-1)&(this.nowtypeselect==0)) { toolTip1.SetToolTip(this.dlltext,"所在动态连接库: "+this.fundll[this.nowselect].ToString()); toolTip1.SetToolTip(this.mat_text,"在C#对应的函数: "+this.funmat[this.nowselect].ToString()); toolTip1.SetToolTip(this.codememo,"函数 "+this.tiplist.SelectedItem.ToString()+" 在C#的调用代码,可以手动修改"); toolTip1.SetToolTip(this.tipsmemo,"函数 "+this.tiplist.SelectedItem.ToString()+" 的注释信息,可以手动修改"); } else if ((this.nowselect>-1)&(this.nowtypeselect==1)) { toolTip1.SetToolTip(this.codememo,"常量 "+this.tiplist.SelectedItem.ToString()+" 在C#的调用代码"); toolTip1.SetToolTip(this.dlltext,"没有相关信息"); toolTip1.SetToolTip(this.mat_text,"没有相关信息"); toolTip1.SetToolTip(this.tipsmemo,"没有相关信息"); } } // private void initdatabase() { string dbpath = @nowpath+"winapi.mdb"; tiplist.Items.Clear(); //@"Provider=Microsoft.Jet.OleDB.4.0;Data Source="+dbpath+";User Id=admin;Password="+this.dbpassword ; //"Provider=Microsoft.Jet.OleDB.4.0;Data Source=your mdb filename;Jet OLEDB:Database Password='pass'" ; this.myConnstr = @"Provider=Microsoft.Jet.OleDB.4.0;Data Source="+dbpath+";User Id=admin;Jet OLEDB:Database Password="+this.dbpassword ; this.myconn= new OleDbConnection(myConnstr); mysql= @"select Fun_name,Fun_dll,Fun_tips,Fun_code,Fun_com,win9x,win2k from winapi"; using(myconn) { myconn.Open(); // if (myconn.State.ToString() == "Open") MessageBox.Show("打开成功!"); //数据处理 // OleDbCommand mycommand = new OleDbCommand(mysql,myconn); mycommand.CommandText = mysql; mycommand.Connection = myconn; OleDbDataReader myreader = mycommand.ExecuteReader(); int i=0; while (myreader.Read()) { tiplist.Items.Add(myreader["Fun_name"]); fundll.Add(myreader["fun_dll"].ToString()); funtips.Add(myreader["fun_tips"].ToString()); funcode.Add(myreader["fun_code"].ToString()); funmat.Add(myreader["fun_com"].ToString()); funwin9x.Add(myreader["win9x"].ToString()); funwin2k.Add(myreader["win2k"].ToString()); i++; } myconn.Close(); myreader.Close(); } } //更新缓存 private void memo_update() { fundll[nowselect] = dlltext.Text; funtips[nowselect] = this.tipsmemo.Text; funcode[nowselect] = this.codememo.Text; funmat[nowselect] = this.mat_text.Text; if (win9x.Checked) funwin9x[nowselect]="Yes" ;else funwin9x[nowselect]="No"; if (win2k.Checked) funwin2k[nowselect]="Yes" ;else funwin2k[nowselect]="No"; } // private void oleDbConnection1_InfoMessage(object sender, System.Data.OleDb.OleDbInfoMessageEventArgs e) { } //==============从WINAPI.TXT读取CONST并拆分 private void mysplip() { //string dbpath = @System.Environment.CurrentDirectory+@"\winapi.mdb"; string filename =@nowpath +"winapi.txt"; string nextline; tiplist.Items.Clear(); StreamReader sr = new StreamReader(filename); while ((nextline = sr.ReadLine())!=null) { if (nextline.StartsWith("public const")) { string[] ss = nextline.Split('='); tiplist.Items.Add(ss[0].Substring(16).Trim()); funcode.Add(nextline); } } sr.Close(); } //============================== private void select_type_SelectedIndexChanged(object sender, System.EventArgs e) { if (select_type.SelectedIndex != this.nowtypeselect) { this.mydisp(); switch (select_type.SelectedIndex) { case 0:initdatabase();this.nowtypeselect=select_type.SelectedIndex;break; case 1:mysplip();this.nowtypeselect=select_type.SelectedIndex;this.dlltext.Clear();this.mat_text.Clear();break; } isenable(this.nowtypeselect); } } private void dlltext_TextChanged(object sender, System.EventArgs e) { } private void richTextBox1_MouseEnter(object sender, System.EventArgs e) { tiplist.Visible = false ; } private void mysearch_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { tiplist.Visible = false ; mysearch.Focus(); } private void tiplist_SelectedIndexChanged(object sender, System.EventArgs e) { autocomp(); } /// /// 修改内容。 /// private void fun_update() { using(myconn) { myconn.ConnectionString = myConnstr; myconn.Open(); try { //if (myconn.State.ToString() == "Open") MessageBox.Show("打开成功!"); isnull();//判断是否有无效 string str_win9x,str_win2k; if (win9x.Checked) str_win9x = "Yes" ; else str_win9x = "No"; if (win2k.Checked) str_win2k = "Yes" ; else str_win2k = "No"; sql_update = "update winapi set Fun_dll = '"+dlltext.Text+"'"+" , Fun_tips = '"+tipsmemo.Text+"'"+" , Fun_code = '"+codememo.Text+"'"+" , Fun_com ='"+mat_text.Text+"' "; sql_update +=" , win9x = '" + str_win9x +"' " + ", win2k = '" + str_win2k+"' "; sql_update +=" where Fun_name ='"+ mysearch.Text+"'"; mycommand.Connection = myconn; mycommand.CommandText = sql_update; mycommand.ExecuteNonQuery(); myconn.Close(); memo_update(); MessageBox.Show(this,"恭喜!更新成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information); } catch { // tipsmemo.Text = sql_update; MessageBox.Show("没有找到相应记录,更新失败!"); } } } //判断是更新的部分是否有效(不能为空) private void isnull() { if (this.mat_text.Text=="") this.mat_text.Text="没有相关信息"; if (this.codememo.Text=="") this.codememo.Text="没有相关信息"; if (this.tipsmemo.Text=="") this.tipsmemo.Text="没有相关信息"; if (this.dlltext.Text=="") this.dlltext.Text="没有相关信息"; } //关键字高亮显示 private void mykeyword() { string[] keywords = new string[5]; keywords[0]=mysearch.Text; keywords[1]="string"; keywords[2]="ref"; keywords[3]="int"; keywords[4]="static extern"; for(int i=0;i0) { index++; switch(i) { case 0: codememo.SelectionColor = Color.Red;break; case 1: codememo.SelectionColor = Color.Green;break; case 2: codememo.SelectionColor = Color.Brown;break; case 3: codememo.SelectionColor = Color.Blue;break; case 4: codememo.SelectionColor = Color.Green;break; //default:codememo.SelectionColor = Color.Blue;break; } } } } // //CONST关键字高亮显示 private void mykeyword1() { string[] keywords = new string[5]; keywords[0]=mysearch.Text; keywords[1]="="; keywords[2]="0"; keywords[3]="int"; keywords[4]="const"; for(int i=0;i0) { index++; switch(i) { case 0: codememo.SelectionColor = Color.Red;break; case 1: codememo.SelectionColor = Color.Blue;break; case 2: codememo.SelectionColor = Color.Green;break; case 3: codememo.SelectionColor = Color.Blue;break; case 4: codememo.SelectionColor = Color.Green;break; //default:codememo.SelectionColor = Color.Blue;break; } if (index>codememo.TextLength) break; } } } // private void button2_Click(object sender, System.EventArgs e) { this.fun_update(); } private void isenable(int i_temp) { if (i_temp==0) { win9x.Enabled=true; win2k.Enabled=true; e_modify.Enabled=true; e_add.Enabled=true; b_modify.Enabled=true; b_add.Enabled=true; } else { win9x.Enabled=false; win2k.Enabled=false; e_modify.Enabled=false; e_add.Enabled=false; b_modify.Enabled=false; b_add.Enabled=false; } } private void button4_Click(object sender, System.EventArgs e) { Application.Exit(); } private void e_modify_CheckedChanged(object sender, System.EventArgs e) { if (e_modify.Checked) b_modify.Enabled = true; else b_modify.Enabled = false; } private void e_add_CheckedChanged(object sender, System.EventArgs e) { if (e_add.Checked) b_add.Enabled = true; else b_add.Enabled = false; } private void timer1_Tick(object sender, System.EventArgs e) { if (this.mat_text.TextLength>0) mat_text.Text = mat_text.Text.Remove(0,1); else mat_text.Text = oldscoll_text; } private void mat_text_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { timer1.Enabled = false ; mat_text.Text = oldscoll_text; } private void codememo_TextChanged(object sender, System.EventArgs e) { } private void tiplist_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { } private void menuItem1_Click(object sender, System.EventArgs e) { Control ct = this.ActiveControl; string temp = ct.Text; Clipboard.SetDataObject(temp); } private void menuItem2_Click(object sender, System.EventArgs e) { } } }
尹成Python27天从入门到实战项目!全课665节讲解详细易操作,助力实战项目能力成长,轻松、简单、易懂!day1  python入门与学习方法精确思维与用到才能记忆深刻课程简介课前介绍计算机简介与硬盘概念内存作用计算机小结编程语言简介操作系统简介python版本简介切换python版本修改环境变量交互式编程两种风格python3代码保存必须是utf-8使用IDE了解注释段落打印三引号注释多行三个单引号python代码要严格对齐文输入字符错误简单数学表达式代码风格三种错误风格系统执行指令运行结果乱码交互式编程绘图绘制线段与圆形改变颜色绘制奥运五环小结习题day1plus python  常量变量数据类型 常量与变量区别标识符关键字输入输出id求地址type求类型python变量是地址赋可以改变类型python主要数据类型复数数据类型自适应变长整数intdel作用连续赋交互对称赋字符串转化与输入输出编程wmv多行拆分多行归并成一行规范用的常量算术运算符科学计数法与数字越界优先级结合性赋运算符数据类型转换四舍五入数据提取时间处理作业day2   python字符串与绘图复习变量None变量参与运算没有赋的情况不会改变绘制立方体绘制五角星时间计算强化实现贷款计算连续输入多个字符串加法与绘图实现显示线段长度数据函数使用快速查阅函数帮助字符串三种风格字符与编号文字符编号问题字符编号用途统一码转义字符意义转义字符用于字符串print高级用法字符串加法与转换字符串小结python所有的数据都是对象字符串格式化了解进制图形绘制重点作业以及学习认知方法day3   python运算符与ifelse逻辑语句第一天上午回顾第二天下午回顾1第二天回顾2.7习题解答2.11习题解答2.26作业KaliLinux简介3.4实现五边形面积计算3.7随机字符生成3.8实数误差与四舍五入3.18解答与特殊字符if简介与空格的作用if处理的是逻辑表达式关系运算符针对数字符串的关系运算符if自动转化Bool类型随机数if缺点且运算符或运算符取反运算符短路效应身份运算符运算符优先级结合性概览pass语句潜台词翻译系统None用途指令翻译系统嵌套嵌套与elif对比以及注意细节习题解答绘图作业与重点day4  语音合成与逻辑循环回顾语音合成简单理解while控制次数WhileElseWhileElse实战whileFloat回顾与ifelse表达式赌博概率分类设计方法-一元二次方程嵌套求有序3个数闰年计算矩形区域随机数ifelse回文数判断10进制转化16进制16进制转十进制暴力穷举无限循环指令循环同步异步黑科技读内存读内存无限循环监测重点与作业day5  复杂逻辑循环while与whileelse编程风格循环控制图形绘制while猜数字输入输出重定向while习题分析可以退出的命令系统for初步简介跑分流程结合for循环小结forfor嵌套forfor分析break断循环contiune结束本次循环双层循环的break与continue分析break与contiue小结一闪一闪亮晶晶循环控制大小与位置对角线绘制圆形口顺时针运动循环等价作业与小结day6  函数实战回顾.算学费输入数据求最大精确划分思维解决最大次大交换数据实现按行显示围棋棋盘绘制国际象棋绘制为什么要用函数函数的四种类型函数的一般形式必须用函数的理由-哥德巴赫函数的本质就是地址函数变量意义函数变量用途装饰器设计模式包含模式函数概念None函数默认参数与返回作为参数名称参数与位置参数参数副本机制副本练习多个返回全局变量与局部变量函数内部引用全局变量函数可以嵌套nolocal处理函数嵌套变量函数nonlocalnonlocal总结开房数据查询day7      函数实战与常用数据结构函数的两种类型函数的本质再分析函数地址切换切换功能ifelse配合地址筛选函数收费函数调用过程函数基本小结return小结位置参数与默认参数混合参数填充混合填充错误情况lambda匿名函数可变长函数字符串常识普及字符串特点字符串不可以修改内部字符list列表list用途tuple简介集合运算字典概念in与notin运算符构造表达式转换数据类型系统小结拓展查询作业day8   字符串实战简单回顾eval与exec简介字符串的简单规范字符串的截取字符串赋规范字符串转义字符字符串常见运算符字符串格式化字符串格式化强化字符串编码简介dir与help查看str字符串函数第一个大以及字符串居显示打印金字塔count统计字符串出现个数字符串编码注意事项解码失败判断字符串以什么为结束tab键转换find函数与rfind函数day9   字符串高级简单回顾..eval与exec简介字符串的简单规范字符串的截取字符串赋规范字符串转义字符字符串常见运算符字符串格式化字符串格式化强化字符串编码简介dir与help查看str字符串函数第一个大以及字符串居显示打印金字塔count统计字符串出现个数字符串编码注意事项解码失败判断字符串以什么为结束tab键转换find函数与rfind函数index函数与rindex函数字符串判断字符串间隔求长度以及左右填充字符串大小取出最大最小字符替换去除空格简单切割换行切割判断开头大小切换以及填充0翻译表.字符串模板小结day10  字符串集合与语音识别实战回顾lset初始化风格set增加与去重set删除元素遍历set类型转化set无法操作单个元素的赋set常见方法set常见运算符set关系运算符判断包含set集合判断frozenset字典的基本定义循环字典判断在不在实现插入与更新字典删除字典详解字典与set无法嵌套迭代器列表生成式生成器生成器节省内存用于循环生成器yield作用生成器简介测试游戏简介游戏初级修改键盘模拟语音控制游戏实现鼠标模拟代码规范函数简化重用列表与元组小结作业day11  阶段综合练习昨日回顾.堆栈函数模块引用系统模块引用与错误列表生成式的若干方法生成矩阵str与reprpython把输入输出设备当作文件处理入英文读取文读取英文读取错误入错误处理文件缓存区文件读取若干种方式for循环按行读取数据文件指针seektell数据结构与文件的交互数据查询并保存结果数据查询小结与数据day12downwithoutdata  数据处理开发大数据指令数据清洗的概念初级数据清洗密码排序次数统计QQ密码概率分布QQ号码分类器.开房数据清洗..区域划分省份划分年龄月份划分日划分day12up  数据实战简单回顾12系统默认编码文编码常见错误字符串切割抓取邮箱抓取用户名与密码排序密码文件统计次数排序.统计文件密码次数密码次数排序day13withoutdata  数据分类与list深入地区分类详解字典分类器数据简单归并数据如何切割数据加密数据解密指令执行判断文件夹编程小结列表归并-删除列表归并-下标小结与作业day14down   面向对象编程与深浅拷贝面向对象与过程的差异self用途动态绑定增加属性方法重载运算符的概念有名对象与匿名对象重载运算符的返回重载运算符多个类型类的拷贝是浅复制深浅拷贝函数调用参数副本原理函数调用可以改变list的元素不可以改变list指向对象当作参数的细节私有变量私有变量用于设计权限私有方法用于设计权限私有变量本质用类的方式读取文件行数密码次数归并数据处理方法简介今日小结作业wmvday14up  暴力穷举与类回顾....排列组合暴力生成穷举密码密码破解必破生成器密码破解小结为啥使用类-代码重用类的一般形式详解self构造函数与析构函数构造函数初始化类的属性最简洁的UI设定窗体的位置以及大小类的实际用途day15down  面向对象数据搜索实战输入处理文本编辑器表格数据树状显示数据搜索可视化第一步实现查询窗体数据搜索可视化第二步实现搜索数据数据搜索可视化第三步实现显示窗体数据可视化第四步显示与搜索串联数据可视化终结作业小结day15up  面向对象设计与图像界面上设计一个类发短信类的方法设计一下短信发送邮件类的设计-设计发邮件类的多文件引用腾讯营销类的设计消息循环消息回掉函数机制lambda按下按钮标签显示文本文本输入框listcombobox选择列表day16up  面向对象与图形界面开发下设计一个类发短信类的方法设计一下短信发送邮件类的设计-设计发邮件类的多文件引用腾讯营销类的设计消息循环消息回掉函数机制lambda按下按钮标签显示文本文本输入框listcombobox选择列表day17  面向对象继承实战昨日小结.,.继承的概念多继承的概念多继承的覆盖私有变量不可以被继承Object类类的常见属性super解决父类重复初始化isinstance多态静态方法类方法数据工具1类的继承数据工具实现小结day18down  正则表达式正则表达式bB贪婪与非贪婪标签.标签解决提取标签名称提取QQ生成邮箱列表工具简单正则表达式编常见的正则表达式复杂正则表达式编复杂表达式代码验证作业与小结day18up 正则表达式实践为什么使用正则表达式正则表达式匹配.预编译的概念搜索技能搜索用在找出第一个邮箱手机提取findall字符串切割筛选正则表达式正则表达式替换单个字符判断括号选择一个字符正则表达式次数正则开头结尾括号与选择正则表达式特殊符号day19down 递归与爬虫实战函数递归模拟文件树文件树事件读取网页抓取邮箱抓取QQ提取http抓取邮箱简单程序框架实现抓取邮箱的框架核心两个函数完成广度遍历深度遍历作.业day19up 深度遍历与广度遍历正则表达式小结最简单递归递归顺序递归求和递归腾讯台阶面试题文件夹的函数遍历文件夹遍历文件夹有层次感栈模拟递归栈模拟递归遍历文件夹栈模拟递归遍历文件夹层次感普及网站提取概念栈修改的逻辑错误广度遍历 day20 正则 爬虫实战行情简介提取页面信息提取股票代码提取股票代码下载功能下载股票批量下载股票抓取1页的股票数据抓取多个页面的股票抓取基金信息作业day21  网络编程与信息安全网络概念UDP协议UDP通信UDP远程控制TCP通信TCP控制测试网站后台网站密码破解作业 day22down  线程通信线程通信线程通信强化线程condition高级线程调度生产者消费者线程池延时线程with作用前台进程后台进程TLS线程独立存储作业day22up  多线程实战多线程核心目标并发主线程与小弟线程多线程解决加速多线程的加速线程冲突基于类实现多线程基于类实现多线程的顺序与乱序互斥锁解决线程冲突死锁-使用锁要注意Rlock解决一个线程反复加锁单线程死锁创建线程的三种风格信号量限制线程数量限定线程数量day23  多进程实战多线程回顾多进程拷贝代码多进程拷贝全局变量获取进程编号subprocess执行LinuxShell信号Linux进程小结__name__进程mutiprocessing创建过程join作用进程不可以用全局变量共享数据进程同步进程pipe发送接收数据进程队列进程队列传输数据进程共享数据进程之间共享数组进程共享字典与list简单小结day23down  多进程多线程综合实战读取CSV入csv单线程统计行数多线程统计行数多进程统计行数多线程检索数据第一步多线程检索赵琳多线程检索找到通知其他人退出多线程检索开放数据并保存同一个文件作业day24up  多进程多线程综合实战多进程检索第一步多进程检索开房数据求平均市多线程解决平均市多进程统计平均市单线程BFS抓取邮箱多线程并行抓取邮箱多线程采集邮箱并保存csv归并多线程归并文件day25down 文件格式处理doc处理系统处理doc与docx文件处理的小结读取并入xls与xlsx读取网络pdf文pdftelnet简介登陆Linux登陆Windows小结day25up  时间编程与单元测试时间的简单风格时间格式化抓取年月日计算时间差时间函数计算时间差date小结python2与3的差异内置函数筛选内置函数map内置的函数sorted新浪数据抓取实时文档测试单元测试函数单元测试一个类day26  综合实战播放音乐设置背景鬼程序协程简介协程传递数据wmv协程编号协程生产者消费者模式office自动化操作wordoffice办公自动化操作exceloffice办公自动化操作outlookoffice办公自动化access开发环境配置访问mdb格式访问accdb格式实现CGI程序显示页面环境变量cgi处理前后端day26down  破解wifi实战扫描wifi扫描网卡区分链接成功或者失败wifi密码爆破工具设计Linux破解简介day27down  飞机大战实战命令行下脱裤创建一个pygame窗体窗体加载背景图片处理消息飞机移动实现基本框架飞机框架飞机销毁双机对战双机对战加载子弹双机与敌机出现发射子弹day27up  数据库实战jython的安装MySQL简介数据库的一般操作MySQL数据类型数据表的创建于删除数据的查询数据的插入数据的删除数据的更新联合查询字段一致数据查询排序排序与分组join与nullmysql用python编程查询数据python数据库增删查改项目简介other  异常与错误综合练习异常与错误的概念作业tryexcept解决异常不出错继续执行密码破解工具进攻数据库爆破mysql异常else异常处理的标准公式弹出异常withas类使用异常继承自定义异常断言密码工具设计三个独立的类密码工具2类链接3类密码工具1类链接3类密码工具分析作业speech   语音识别问题解决语音识别解决None

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧