Naar inhoud springen

Programmeren in ASP.net 2.0 N-Tier Tutorial/Data Access Laag/MessageDataAccessor.cs

Uit Wikibooks

C#-code: "MessageDataAccessor.cs"

using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;

using MessageBoard.Common.DataSets;

namespace MessageBoard.DataAccess
{
	public class MessageDataAccessor: DataAccessor
	{
		public MessageDataSet GetMessages()
		{
			string sql = "SELECT * FROM Message";
			DbCommand cmd = Database.CreateSqlCommand(sql);
			MessageDataSet data = new MessageDataSet();
			Database.LoadDataSet(cmd, data, "Message");
			return data;
		}

		protected override DbCommand GetInsertCommand()
		{
			throw new Exception("The method or operation is not implemented.");
		}

		protected override DbCommand GetUpdateCommand()
		{
			throw new Exception("The method or operation is not implemented.");
		}

		protected override DbCommand GetDeleteCommand()
		{
			throw new Exception("The method or operation is not implemented.");
		}
	}
}
Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.