namespace SQLNameSpaceC
{
	using System;
	using System.Data;
	using System.Data.OleDb;
	using System.Text;

	public class SQLClassC
	{
		private String ls_connStr;
		private String ls_sql;

		public String ConnStr
		{
			get
			{
				return ls_connStr;
			}
			set
			{
				ls_connStr = value;
			}
		}

		public String SQL
		{
			get
			{
				return ls_sql;
			}
			set
			{
				ls_sql = value;
			}
		}



		public DataView Populate()
		{
			//返回查询的数据
			//绑定控件
			OleDbConnection myConnection = new OleDbConnection(ConnStr);
			OleDbDataAdapter myCommand = new OleDbDataAdapter(SQL, myConnection);
			DataSet ds = new DataSet();
			myCommand.Fill(ds, "vTable");
			return ds.Tables["vTable"].DefaultView;
		}

		public String RunSQL( string vsql)
		{
			try
			{
				OleDbConnection myConnection = new OleDbConnection(ConnStr);
				OleDbCommand mycommand = new OleDbCommand(vsql,	myConnection);
				myConnection.Open();
				mycommand.ExecuteNonQuery();
				myConnection.Close();
			}
			catch(Exception e)
			{
				string ret =	"出现异常: " + e.ToString() ;
			}

			return("OK");

		}


		public String test()
		{
			StringBuilder SB = new StringBuilder(ls_connStr);
			SB.Append(" ," + ls_sql);
			return SB.ToString();

		}

	}

}

