listboxgaatmee.dragdrop += new DragEventHandler(listBox_DragDrop); ListBox from = (ListBox)e.Data.GetData(typeof(ListBox));

Similar documents
VB.NET - DATABASE ACCESS

ASP.NET Programming with C# and SQL Server

Database: Data > add new datasource ALGEMEEN

Conexión SQL Server C#

SQL injection attacks SQL injection user input SQL injection SQL Command parameters Database account. SQL injection attacks Data Code

Intermediate ASP.NET Web Development with C# Instructor: Frank Stepanski. Data Sources on the Web

5 Airport. Chapter 5: Airport 49. Right-click on Data Connections, then select Add Connection.

Access Data Object (cont.)

Database Communica/on in Visual Studio/C# using Web Services. Hans- Pe=er Halvorsen, M.Sc.

How To: Create a Crystal Report from ADO.NET Dataset using Visual Basic.NET

AD A O.N. ET E Access Data Object

Mastering Visual Basic.NET Database Programming Evangelos Petroutsos; Asli Bilgin

Installation and Operation Manual Unite Log Analyser

INTEGRATING MICROSOFT DYNAMICS CRM WITH SIMEGO DS3

(VB) - Pro: Designing and Developing Windows Applications Using the Microsoft.NET Framework 3.5

A Tutorial on SQL Server CMPT 354 Fall 2007

Real-World ASP.NET: Building a Content Management System

ASP.NET(C#) ile Kayıt Listeleme, Silme ve Düzenleme İşlemi

Relationele Databases 2002/2003

1. To start Installation: To install the reporting tool, copy the entire contents of the zip file to a directory of your choice. Run the exe.

Building ASP.NET Applications

Working with SQL Server Integration Services

Hi, processing. Code of the vb.net version. Imports System.Data Imports System.Data.SqlClient

GoDaddy (CentriqHosting): Data driven Web Application Deployment

ADOBE READER AND ACROBAT

CPM release notes

MS Enterprise Library 5.0 (Logging Application Block)

Technical Specification ideal

Printer Connection Manager

Self-test SQL Workshop

The Developer Side of the MS Business Intelligence Stack

Tivoli Endpoint Manager BigFix Dashboard

1.Tüm Kayıtları Getirme - Arama Yapma

This is a training module for Maximo Asset Management V7.1. It demonstrates how to use the E-Audit function.

User Management Resource Administrator. UMRA tables. User Guide

Database Communica/on in Visual Studio/C# using ASP.NET Web Forms. Hans- PeBer Halvorsen, M.Sc.

Specification by Example (methoden, technieken en tools) Remco Snelders Product owner & Business analyst

Network Assessment Client Risk Report Demo

Crystal Reports for Visual Studio.NET

Aplicação ASP.NET MVC 4 Usando Banco de Dados

Kaseya 2. Quick Start Guide. for VSA 6.3

Developing Own Crystal Reports

InstantSearch+ for Magento Extension

MAKER FOR VTIGER CRM

Before you may use any database in Limnor, you need to create a database connection for it. Select Project menu, select Databases:

When a variable is assigned as a Process Initialization variable its value is provided at the beginning of the process.

Contents. Introduction. Chapter 1 Some Hot Tips to Get You Started. Chapter 2 Tips on Working with Strings and Arrays..

Use the ADO Control in your Visual Basic 6 projects

Tuesday, February 26, Unit testen in de praktijk

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

Getting Started with Telerik Data Access. Contents

Working with Data in ASP.NET 2.0 :: Creating Stored Procedures and User Defined Functions with Managed Code Introduction

agileworkflow Manual 1. agileworkflow 2. The repository 1 of 29 Contents Definition

RSS Feed from an Access Database

Web Development using PHP (WD_PHP) Duration 1.5 months

TIBCO Spotfire Metrics Modeler User s Guide. Software Release 6.0 November 2013

User manual RABO INTERNET BANKING

Social Media in the Process Automation Industry

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

How To Develop A Mobile Application On Sybase Unwired Platform

Database Programming with C# CARSTEN THOMSEN

Aras Corporation Aras Corporation. All rights reserved. Notice of Rights. Notice of Liability

How To Create A Database In Araba

v1.1.0 SimpleSQL SQLite manager for Unity3D echo17.com

Supporting Data Set Joins in BIRT

The software shall provide the necessary tools to allow a user to create a Dashboard based on the queries created.

Uniface en PostgreSQL, de eerste ervaringen

Differences at a glance

DIPLOMA IN WEBDEVELOPMENT

ACDS AIMS Certified Database Specialist Course.

Chapter 4 Accessing Data

Generating Automated Test Scripts for AltioLive using QF Test

How-To: MySQL as a linked server in MS SQL Server

The software shall provide the necessary tools to allow a user to create a Dashboard based on the queries created.

Installation & User Guide

MAKER FOR VTIGER CRM

Web Services API Developer Guide

Maximizer Synergy. BE Houwaartstraat 200/1 BE 3270 Scherpenheuvel. Tel: Fax:

ASP.NET Using C# (VS2012)

Installing the ASP.NET VETtrak APIs onto IIS 5 or 6

Release Notes LS Retail Data Director August 2011

FOREFRONT IDENTITY MANAGEMENT

SQL Injection. The ability to inject SQL commands into the database engine through an existing application

Beginning C# 5.0. Databases. Vidya Vrat Agarwal. Second Edition

Performance Testing Microsoft Dynamics NAV

DEVELOPING A PHD MONITORING TOOL USING ASP.NET AND SQL SERVER. A Report Submitted In Partial Fulfillment Of Course BITS C331 Computer Oriented Project

EBOX Digital Content Management System (CMS) User Guide For Site Owners & Administrators

Buurten van gemeente Groningen

EXAM PRO:Design & Develop Windows Apps Using MS.NET Frmwk 4. Buy Full Product.

Verticale tuin maken van een pallet

Creating the Product Catalog Part I (continued)

USING FILERELICATIONPRO TO REPLICATE SQL SERVER

Visual Basic Database Connectivity

Siemens Applied Automation Page 1 11/26/03 9:57 PM. Maxum ODBC 3.11

Transcription:

1 Module 1 1.1 DragDrop listboxgaatmee.dragenter += new DragEventHandler(control_DragEnter); e.effect = DragDropEffects.Move; //noodzakelijk, anders geen drop mogelijk (retarded I knows) listboxgaatmee.dragdrop += new DragEventHandler(listBox_DragDrop); ListBox from = (ListBox)e.Data.GetData(typeof(ListBox)); listboxgaatmee.allowdrop = true; // hier mag gedropt worden 1.2 Image lists Is een Control, slepen op form, komt onderaan te staan, en dan Choose images in extra menu van het control beest. 1.3 ListView, TreeView, Eerst BeginUpdate, dan EndUpdate() 1.4 TreeView TreeNode rootnode = treeview.nodes.add( UniquieKey, Visible text, afbeeldingindex); TreeNode childnode = rootnode.nodes.add( node.nodes.find(key, recurse) 1.5 ListView listview.columns.add(name, width, alignment); item = new ListViewItem( first col text ); itme.subitems.add( second col text ); listview.items.add(item) 1.6 ToolTips New ToolTip() tt instellen... tooltip.settooltip(controlthatneedstooltip, tekst om te tonen ) tooltip.settooltip(anothercontrolthatneedstooltip, tekst om te tonen ) 1.7 MDI (this) Parent.IsMDIContainer = true child.mdiparent = parent (this) child.show() parent.layoutmdi(mdilayout. ) parent.activemdichild

1.8 Toolstrip DisplayStyle = ImageAndText, ImageScaling = None, 1.9 Properties private int Lol get; set; public int Purr set mirr = value; 2 ADO (module 2) 2.1 Algemeen en most manual ADO Using System.Data.SqlClient, System.Data Id van laatste insert: SELECT @@IDENTITY of SELECT SCOPE_IDENTITY() Bv: INSERT ; SELECT @@IDENTITY met executescalar 2.1.1 App.Config <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionstrings> <add name="thuis" connectionstring="data Source=.\SQLEXPRESS; AttachDbFilename=c:\...\Contactpersonen.mdf; Integrated Security=True; User Instance=True;"/> <add name="school" connectionstring="server=codd; Database=Ti2_CSharp_s50 ; Integrated Security=SSPI;"/> <add name="bis" connectionstring="data Source=codd; Initial Catalog=Ti2_CSharp_s50 ;User Id=s50 ;Password= ;"/> </connectionstrings> </configuration> See also: 3TIER > DABaseClass 2.1.2 Databinding DataSource, DisplayMember, ValueMember 2.1.3 DataReader (en SQL fetchness) SqlConnection connection = new SqlConnection(connectionString); connection.open(); SqlCommand command = new SqlCommand( Select * from Contact order by Naam", connection); SqlDataReader datareader = command.executereader(); while (datareader.read()) datareader["col"] datareader.close(); connection.close();

2.1.4 SQL Params SqlCommand command = new SqlCommand("Update Contact set naam = @naam, email = @email where id = @id", connection); // Let op: dezelfde volgorde gebruiken als voorkomen in SQL-statement command.parameters.add(new SqlParameter("@naam", textboxnaam.text)); 2.2 basic 3TIER (using sql commands directly) 2.2.1 DABaseClass using System.Configuration; using System.Data.SqlClient; class DABaseClass private static string connectionstring = ConfigurationManager.ConnectionStrings["thuis"].ConnectionString; protected SqlConnection connection; public void Open() connection = new SqlConnection(connectionString); connection.open(); public void Close() connection.close(); 2.2.2 DAKlant Class DAKlant : DABaseClass public List<Album> GetAlbumsByReeks(int reeksid) //sql command statements public void UpdateAlbum(Album album) //accepts an entity class! Delete accepts id though 2.2.3 BLKlant Class BLKlant : DAKlant //No sql in ere! Just logic stuff like, if this changes, that must change too

2.3 DataSets + DataAdapters straight to the DB 2.3.1 Datasets zelf aanmaken (hardcore) var dataset = New DataSet() DataTable tablewerknemer = new DataTable("werknemer"); DataTable tableafdeling = new DataTable("afdeling"); dataset.tables.add(tablewerknemer); dataset.tables.add(tableafdeling); DataColumn kolom = new DataColumn("id", typeof(int32)); kolom.allowdbnull = false; kolom.unique = true; tablewerknemer.columns.add(kolom); tablewerknemer.primarykey = new DataColumn[] tablewerknemer.columns["id"] ; dataset.relations.add( new DataRelation("fkAfdelingWerknemer", tableafdeling.columns["id"], tablewerknemer.columns["afdelingid"], true)); 2.3.2 Row insert DataRow rij = tablewerknemer.newrow(); rij["id"] = 1; rij["naam"] = "Jef Verboven"; tablewerknemer.rows.add(rij); 2.3.3 Navigeren met relaties DataRow afdeling foreach (DataRow werknemer in afdeling.getchildrows("fkafdelingwerknemer")) 2.3.4 Filtering table.select("afdelingid = 1", "Naam ASC"); OR DataView dataviewfilter = new DataView(dataset.Tables["werknemer"]); dataviewfilter.sort = "naam Asc"; dataviewfilter.rowstatefilter = DataViewRowState.CurrentRows; dataviewfilter.rowfilter = "afdelingid = 1"; DataTable filterrecord = dataviewfilter.totable();

2.3.5 Row editing row.beginedit(); row ["naam"] = textboxnaam.text; row.endedit(); 2.3.6 Dataset + DataAdapter SqlCommand ploegcommand = new SqlCommand("Select * From Ploeg", connection); SqlDataAdapter ploegadapter = new SqlDataAdapter(ploegCommand); 2.3.6.1 Automatisch update, insert, delete commands aanmaken op adapter // De ctor stelt automatisch insert commando s in op onze adapter, het return obj mag men negeren :/ new SqlCommandBuilder(rennerAdapter); 2.3.6.2 Data laden ploegadapter.fill(dataset, "Ploeg"); 2.3.6.3 Wegschrijven naar db try renneradapter.update(dataset, "Renner"); catch (DBConcurrencyException extransaction) 2.4 3TIER again, with datasets and dataadapters (doubt we ll need this) 2.4.1 DAL Make sql command, give to adapter, store adapter in DA. Take dataset as param. Fill, Update shizzle 2.5 More 3TIER, but with Typed Datasets now! In DAL package: Add new Item > DataSet (geef het een naam die niet hetzelfde is als iets anders in proj ) Drag stuff onto it from server explorer, modify with Configure in context menu, pick Return datatable where appropriate. 2.5.1 DAL Autogenerated by dataset.xsd thing 2.5.2 BL using ProjectManagement.DAL; using ProjectManagement.DAL.PJManagementTableAdapters; class BLTask private TasksTableAdapter adapter; public BLTask()

adapter = new TasksTableAdapter(); public PJManagement.TasksDataTable GetFilteredTasks(int projectid, int StateID, int priorityid) return adapter.getfilteredtasks(priorityid, priorityid, StateID); 2.5.3 Forms (front-end) using ProjectManagement.BLL; using ProjectManagement.DAL; Runs round using typed DataTables and DataRows and requests them from BLL. 3 Module 3 3.1 Unit testing Add Test Project Add ref to own project Check if classes in project that we want to test are public 3.1.1 Basic testing Use Assert.AreEqual, Test for exceptions with: [ExpectedException(typeof(SaldoOntoereikendException))] 3.1.1.1 Init code [ClassInitialize()] executed before First test 3.1.1.2 Cleanup code [ClassCleanup()] executed after last test 3.1.1.3 Ignore method [TestMethod, Ignore()] 3.1.2 Testing SQL DB projects Add refs to System.Data, System.Data.DataSetExtensions, System.Xml In init and cleanup use the methods of the target proj itself, this way we don t need to know a thing about the DB, the other project will need to though. ^^ 3.1.3 Data driven unit test (xml file erin pompen met test data) Go to Test Windows TestListEditor. Click test, go to properties, click data connection string. Select xml in popup, go to file Use TextContext.DataRow in test (test method is rerun for every row)

3.2 Delegates public delegate Boolean MijnFunctie(T parameter1, T parameter2); 3.3 Threading using System.Threading; thread = new Thread(someFunc); thread.start(); 3.3.1 Sleeping Thread.Sleep(250); 3.3.2 Queueing stuff on the gui thread //this refers to a gui thing, every Control has Invoke(delegate(no args)) this.invoke(new MethodInvoker(ListBoxClear));

3.3.3 Adding params to the threading public class Counter private int max; public int Max set max = value; public void Count() for (int i = 0; i <= max; i++) Console.WriteLine(Thread.CurrentThread.Name + " counts " + i); Thread.Sleep(250); Console.WriteLine(Thread.CurrentThread.Name + " stops counting..."); Counter counter = new Counter(); counter.max = aantalthreads; Thread thread = new Thread(counter.Count); thread.name = "Thread " + aantalthreads; thread.start(); 3.3.4 Cleanup nicely // mark thread as background Thread ghostshower = new Thread(ShowGhost); ghostshower.isbackground = true; // unless you add Application.Exit() to closing event, the form is just disposed of // This kills all background threads and gui threads Application.Exit() 3.3.5 Syncing object countlock = new object(); lock (countlock) // dit codeblok kan maar door 1 thread tegelijk uitgevoerd worden