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

📄 bookqueurydb.cs

📁 图书馆的书目查询
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace Library_BS
{
	/// <summary>
	/// BookQueuryDB 的摘要说明。
	/// </summary>
	public class BookQueuryDB
	{
		public BookQueuryDB()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		public DataSet GetBookByAskforIDCommon(string AskforID)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookByAskforIDCommon", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterAskforID = new SqlParameter("@AskforID", SqlDbType.VarChar, 50);
			parameterAskforID.Value = AskforID;
			myAdapter.SelectCommand.Parameters.Add(parameterAskforID);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"AskforIDCommon");

			// Return the DataSet
			return myDataSet;

		}
		public DataSet GetBookByAskforIDSame(string AskforID)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookByAskforIDSame", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterAskforID = new SqlParameter("@AskforID", SqlDbType.VarChar, 50);
			parameterAskforID.Value = AskforID;
			myAdapter.SelectCommand.Parameters.Add(parameterAskforID);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"AskforIDSame");

			// Return the DataSet
			return myDataSet;

		}
		public DataSet GetBookByAuthorCommon(string author)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookByAuthorCommon", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterAuthor = new SqlParameter("@author", SqlDbType.VarChar, 100);
			parameterAuthor.Value = author;
			myAdapter.SelectCommand.Parameters.Add(parameterAuthor);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"AuthorCommon");

			// Return the DataSet
			return myDataSet;

		}

		public DataSet GetBookByAuthorSame(string author)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookByAuthorSame", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterAuthor = new SqlParameter("@author", SqlDbType.VarChar, 100);
			parameterAuthor.Value = author;
			myAdapter.SelectCommand.Parameters.Add(parameterAuthor);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"AuthorSame");

			// Return the DataSet
			return myDataSet;

		}
		public DataSet GetBookByISBNCommon(string ISBN)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookByISBNCommon", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterISBN = new SqlParameter("@ISBN", SqlDbType.VarChar, 40);
			parameterISBN.Value = ISBN;
			myAdapter.SelectCommand.Parameters.Add(parameterISBN);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"ISBNCommon");

			// Return the DataSet
			return myDataSet;

		}
		public DataSet GetBookByISBNSame(string ISBN)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookByISBNSame", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterISBN = new SqlParameter("@ISBN", SqlDbType.VarChar, 40);
			parameterISBN.Value = ISBN;
			myAdapter.SelectCommand.Parameters.Add(parameterISBN);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"ISBNSame");

			// Return the DataSet
			return myDataSet;

		}
		public DataSet GetBookByNameCommon(string name)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookByNameCommon", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterName = new SqlParameter("@name", SqlDbType.VarChar, 100);
			parameterName.Value = name;
			myAdapter.SelectCommand.Parameters.Add(parameterName);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"NameCommon");

			// Return the DataSet
			return myDataSet;

		}
		public DataSet GetBookByNameSame(string name)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookByNameSame", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterName = new SqlParameter("@name", SqlDbType.VarChar, 100);
			parameterName.Value = name;
			myAdapter.SelectCommand.Parameters.Add(parameterName);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"NameSame");

			// Return the DataSet
			return myDataSet;

		}
		public DataSet GetBookBySortIDCommon(string SortID)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookBySortIDCommon", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterSortID = new SqlParameter("@SortID", SqlDbType.VarChar, 50);
			parameterSortID.Value = SortID;
			myAdapter.SelectCommand.Parameters.Add(parameterSortID);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"SortIDCommon");

			// Return the DataSet
			return myDataSet;

		}
		public DataSet GetBookBySortIDSame(string SortID)
		{
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlDataAdapter myAdapter = new SqlDataAdapter("GetBookBySortIDSame", myConnection);
			//SqlCommand myCommand = new SqlCommand("GetCurrentBorrow", myConnection);

			// Mark the Command as a SPROC
			//myCommand.CommandType = CommandType.StoredProcedure;
			myAdapter.SelectCommand.CommandType=CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterSortID = new SqlParameter("@SortID", SqlDbType.VarChar, 50);
			parameterSortID.Value = SortID;
			myAdapter.SelectCommand.Parameters.Add(parameterSortID);

			// Create and Fill the DataSet
			DataSet myDataSet = new DataSet();
			myAdapter.Fill(myDataSet,"SortIDSame");

			// Return the DataSet
			return myDataSet;

		}
	}
}

⌨️ 快捷键说明

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