customerinfosearch.cs

来自「.NET编写的小型图书管理系统,里面有详细说明,源码,发布软件包和数据库文件,本」· CS 代码 · 共 42 行

CS
42
字号
using System;
using System.Data;
using bookShop.classLib.dbLib;

namespace bookShop.classLib.dataLayer
{
	/// <summary>
	/// CustomerInfoSearch 的摘要说明。
	/// </summary>
	public class CustomerInfoSearch
	{
		private string customerID;
		private string customerName;
		public CustomerInfoSearch(string customerID,string customerName)
		{
			this.customerID=customerID;
			this.customerName=customerName;
		}
		public DataSet Search()
		{
			DataSetDBConnect ds=new DataSetDBConnect("table");
			ds.StrSQL="select * from Customer where ";
			int conditionCount=0;
			if(customerID!=String.Empty)
			{
				ds.StrSQL+="CustomerID='"+customerID+"' ";
				conditionCount++;
			}
			if(customerName!=String.Empty)
			{
				if(conditionCount>0)
					ds.StrSQL+="and ";
				ds.StrSQL+="CustomerName='"+customerName+"'";
				conditionCount++;
			}
			ds.Do();
			ds.Close();
			return ds.ObjDataSet;			
		}
	}
}

⌨️ 快捷键说明

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