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

📄 busandstop.cs

📁 工交车查询系统
💻 CS
字号:
using System;
using System.Data;
using System.Data.OleDb;
using Sun188.iSBus.Common;
using System.Collections;

namespace Sun188.iSBus.DataAccess
{
	/// <summary>
	/// BusAndStop 的摘要说明。
	/// </summary>
	public class BusAndStop
	{
		private OleDbConnection conn = null;
		public BusAndStop()
		{
			this.conn = new Conn().Connection();			
		}

		/// <summary>
		/// 获取相关站点下的汽车列表
		/// </summary>
		/// <param name="stopID">站点编号</param>
		/// <returns>DataSet</returns>
		public DataSet GetBusData(int stopID)
		{
			string strSQL =@"SELECT * FROM V_BusInStop WHERE StopID="+stopID+"";
			OleDbDataAdapter da = new OleDbDataAdapter(strSQL,this.conn);
			DataSet ds = new DataSet();
			da.Fill(ds,"Bus");
			return ds;
		}

		/// <summary>
		/// 获取相关汽车下的站点列表
		/// </summary>
		/// <param name="busID">汽车编号</param>
		/// <returns>DataSet</returns>
		public DataSet GetStopData(int busID)
		{
			string strSQL =@"SELECT * FROM V_StopInBus WHERE BusID="+busID+"";
			OleDbDataAdapter da = new OleDbDataAdapter(strSQL,this.conn);
			DataSet ds = new DataSet();
			da.Fill(ds,"Stop");
			return ds;
		}

		/// <summary>
		/// 保存数据
		/// </summary>
		/// <param name="arraySql">SQL数组</param>
		/// <returns>true/false</returns>
		public bool SaveBusData(ArrayList arraySql)
		{
			bool result = false;
			string sql = "";
			if(this.conn.State != ConnectionState.Open)
			{
				this.conn.Open();
			}
			try
			{
				for(int i=0;i<arraySql.Count;i++)
				{
					sql = arraySql[i].ToString();			
					OleDbCommand cmd = new OleDbCommand(sql,this.conn);					
					cmd.ExecuteNonQuery();
					result = true;
				}
				
			}
			catch
			{
				result = false;
			}
			finally
			{
				this.conn.Close();
				this.conn.Dispose();
			}
			return result;
		}
	}
}

⌨️ 快捷键说明

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