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

购物网站做推广西安seo网站排名

购物网站做推广,西安seo网站排名,做网站要求什么,有做网站设计吗非常简单,直接给出代码: 数据库操作类 这个无需多言就是简单的包含了数据操作的内容,允许你在这一个类中写完关于本地数据库或者云数据库操作的逻辑,与登录逻辑分开哦。 注意,如果你的软件要给别人运行使用&#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.15wanjia.com/news/16098.html

相关文章:

  • 公司注册大概多少钱百度整站优化
  • 动态网站用什么语言做百度seo关键词排名查询
  • WordPress网站远程访问泉州百度推广排名优化
  • 帮人家做网站维护抄一则新闻四年级
  • 制作app网站推广app拿返佣的平台
  • wordpress织梦博客seo优化技术
  • 南宁做网站推广seo关键词优化推广报价表
  • 做电影网站采集什么意思app运营方案
  • 苏州吴江网站建设广州百度推广代理公司
  • 虚拟主机怎么上传网站最近最火的关键词
  • 广东专业移动网站建设哪家好重庆发布的最新消息今天
  • web 设计网站模板下载产品推广软文范文
  • 公司注册核名在哪个网站2022适合小学生的简短新闻
  • 淘宝做网站很便宜清远新闻最新
  • 好看的旅游网站模版seo营销的概念
  • 日照网站制作公司网络工程师是干什么的
  • 杭州清风室内设计学校青岛seo公司
  • 人力资源公司怎么开seo网络推广员招聘
  • 做1688网站到哪里找图片百度一下就会知道了
  • 微信开发网站建设企业建网站一般要多少钱
  • 备案网站电子照幕布百度博客收录提交入口
  • 做外贸没有网站腾讯企业qq官网
  • 现在流行什么做网站百度推广关键词价格查询
  • 公安网站建设自查报告西安疫情最新数据消息中高风险地区
  • 广州网站建设定制方案徐州seo企业
  • 网站推广免费 优帮云企业宣传ppt
  • 2017网站建设报价方案跨境电商平台推广
  • 网站建设属于什么支出互联网运营
  • 做b2b网站销售怎样让客户找上门精准客户资源购买
  • 永年网站建设营销网站建设多少钱