当前位置: 首页 > news >正文

网站开发的成本发免费广告电话号码

网站开发的成本,发免费广告电话号码,wordpress主题幻灯片,商丘建网站非常简单,直接给出代码: 数据库操作类 这个无需多言就是简单的包含了数据操作的内容,允许你在这一个类中写完关于本地数据库或者云数据库操作的逻辑,与登录逻辑分开哦。 注意,如果你的软件要给别人运行使用&#xf…

非常简单,直接给出代码:

数据库操作类

这个无需多言就是简单的包含了数据操作的内容,允许你在这一个类中写完关于本地数据库或者云数据库操作的逻辑,与登录逻辑分开哦。

注意,如果你的软件要给别人运行使用,你的数据库信息也可以存在授权文件中,以避免出现信息的泄露。如果你使用软件直接操作数据库可能存在危险,请注意连接数据库时对sql语句的检查。

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace chuankouzhushou1
{internal class dataoperator{private static string connString = @"Data Source=DREAMER;Database=db_Mydb;User ID=sa;Pwd=yourpasswd;";public static SqlConnection connection = new SqlConnection(connString);public int ExecuteSQL(string sql){SqlCommand cmd = new SqlCommand(sql, connection);if (connection.State == ConnectionState.Closed)connection.Open();int num = Convert.ToInt32(cmd.ExecuteScalar());        //执行查询connection.Close();return num;}public int ExecuteSQLResult(string sql){SqlCommand cmd = new SqlCommand(sql, connection);if (connection.State == ConnectionState.Closed)connection.Open();int result = cmd.ExecuteNonQuery();connection.Close();return result;}public DataSet GetDataSet(string sql){SqlDataAdapter sqlda = new SqlDataAdapter(sql, connection);    //指定要执行的SQL语句DataSet ds = new DataSet();sqlda.Fill(ds);return ds;}public SqlDataReader GetDataReader(string sql){SqlCommand cmd = new SqlCommand(sql, connection);if (connection.State == ConnectionState.Closed)connection.Open();SqlDataReader dataReader = cmd.ExecuteReader();//添加参数CommandBehavior.CloseConnection就可以自动释放连接return dataReader;}}
}

输入的监测 

 private bool ValidateInput(){if (tx_ID.Text.Trim() == "")                            //登录账号{MessageBox.Show("请输入登录账号", "登录提示", MessageBoxButtons.OK, MessageBoxIcon.Information);tx_ID.Focus();                                    //使登录账号文本框获得鼠标焦点return false;}else if (tx_ID.Text.Length>30){MessageBox.Show("请输入正确的登录账号", "登录提示", MessageBoxButtons.OK, MessageBoxIcon.Information);tx_ID.Focus();                                    //使登录账号文本框获得鼠标焦点return false;}else if (tx_ID.Text.Length > 5 && tx_PWD.Text.Trim() == "")   //密码{MessageBox.Show("请输入密码", "登录提示", MessageBoxButtons.OK, MessageBoxIcon.Information);tx_PWD.Focus();                                    //使密码文本框获得鼠标焦点return false;}return true;}

 登录按钮(回车实现登录)

private void loginbtn(object sender, EventArgs e){if(ValidateInput()){int num= 0;string sql = "select count(*) from usertb where userid=" + int.Parse(tx_ID.Text.Trim()) + " and userpwd = '" + tx_PWD.Text.Trim() + "'";try{num = dbop.ExecuteSQL(sql);}catch {//MessageBox.Show(e.ToString());}   if (num == 1)//验证通过{publicinfo.userid = int.Parse(tx_ID.Text.Trim());// 执行新的SQL查询来获取userid,username和userlvsql = "select userid, username, userlv from usertb where userid=" + publicinfo.userid;SqlDataReader reader = dbop.GetDataReader(sql);if (reader.Read()){publicinfo.userid = reader.GetInt32(0);publicinfo.username = reader.GetString(1);publicinfo.userlv = reader.GetInt32(2);}reader.Close();mainfrm frm_Main = new mainfrm();frm_Main.Show();this.Visible = false;}else{MessageBox.Show("登录失败!", "登录提示", MessageBoxButtons.OK, MessageBoxIcon.Information);}}}private void tx_ID_KeyPress(object sender, KeyPressEventArgs e){if (char.IsDigit(e.KeyChar) || (e.KeyChar == '\r') || (e.KeyChar == '\b'))e.Handled = false;elsee.Handled = true;}

http://www.tj-hxxt.cn/news/32603.html

相关文章:

  • 武汉做网站小程序哪家公司好百度关键词挖掘
  • 天津建设网站首页国内做网站比较好的公司
  • 国内做服装的网站有哪些方面今日新闻头条10条
  • 惠济区城乡建设局网站百度云登陆首页
  • 如何做网站的订阅华为seo诊断及优化分析
  • 产品查询展示型网站如何宣传推广产品
  • Javaweb就是做网站吗steam交易链接怎么改
  • 企业营销网站建设公司哪家好百度快速收录提交工具
  • 搜狗站群系统产品推广运营方案
  • 广州商城网站建设网站seo视频狼雨seo教程
  • 做钓鱼网站获利3万惠州seo
  • 北京商场需要几天核酸seo站长
  • 常州网约车哪个平台最好seo公司后付费
  • 网站网站制作需要多少钱如何做品牌宣传与推广
  • 程序员做博彩类的网站犯法吗我的百度网盘登录入口
  • 苗木门户网站模板西安市网站
  • vs2015 手机网站开发电商培训心得体会
  • 中介网站制度建设站长工具seo综合查询访问
  • 移动应用开发公司网站模板免费网站在线客服系统源码
  • 外贸公司做网站深圳网络推广网站推广
  • 如何用wordpress做企站长沙网站seo报价
  • 建个企业网站对公司宣传有用吗网上怎么免费推广
  • 陶瓷 网站模板福州seo技巧培训
  • 深圳做分销商城网站优化游戏性能的软件
  • html做网站品牌战略
  • 设计接单平台app排行榜seo都用在哪些网站
  • 帮人代做静态网站多少钱武汉seo服务多少钱
  • 专业建站公司主要做什么郑州官网关键词优化公司
  • 手机终端网站怎么写网站
  • asp.net网站怎么做全国推广优化网站