⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 verifier.cs

📁 一个WINCE下用ado.net连接数据库的例子 作者:tanis
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;


namespace AutoRefresh
{
	/// <summary>
	/// 
	/// </summary>
	public class Verifier
	{
		private string sConnectString ="";// "Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=60.63.208.231;Packet Size=4096";
		private string sSqlCmdString = "";//"select * from myfile where userid = 'wanghaili'  and userpassword = 'wanghaili'";

	    private string sOutMessage = "";
		
	//	private Form3 pform3 = null;																									  
     
		public Verifier()
		{
			// 
			// TODO: 在此处添加构造函数逻辑
			sConnectString = "Persist Security Info=False;User ID=sa;Initial Catalog= mysql;Data Source="+ Form1.static_Para.sServerName +";Packet Size=4096";
            //sConnectString = "Persist Security Info=False;User ID=sa;Initial Catalog=mysql;Data Source=WANGHAILI;Packet Size=4096";
			sSqlCmdString = "select * from TB_UserInfo where username = '" + Form1.static_Para.sUserName + "' and password = '" +Form1.static_Para.sUserPsw+ "'";
			//
		}

		public string GetLastMessage()
		{
			return sOutMessage;
		}

		public bool start()
		{
			bool rlt = false;
			try
			{
				SqlConnection myConnection = new SqlConnection(sConnectString);
				SqlCommand myCommand = new SqlCommand(sSqlCmdString);
				myCommand.Connection = myConnection;
				myConnection.Open();
				if(myCommand.ExecuteScalar() != null )
				{
					rlt = true;
				}
				else
				{
					rlt = false;
				}
				myCommand.Connection.Close();
				return rlt;
			}
			catch(Exception ex)
			{
				sOutMessage = ex.Message;
				return rlt;
   			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -