Archive for Mai, 2008

PostgreSQL mit .NET via ODBC

Dienstag, Mai 27th, 2008

Wichtig: Im Zusammenhang mit der LAP 2007 steht der Inhalt selbstverständlich wie alle anderen Dokumente unter der Bierlizenz (siehe LAP-Wiki). :)

Die Herren, für morgen ein kleines Sample, wie aus .NET auf eine PostgreSQL-Datenbank zugegriffen wird:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Odbc;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
using(OdbcConnection cn = new OdbcConnection("Dsn=DateNDrive"))
{
cn.Open();
// Important: It seems necessary that table names must be in
// double quotes!
using(OdbcCommand cmd
= new OdbcCommand("select * from \"public\".\"Fahrzeug\"", cn))
{
using(DataSet ds = new DataSet())
{
using(OdbcDataAdapter da = new OdbcDataAdapter(cmd))
{
da.Fill(ds);
foreach(DataRow dr in ds.Tables[0].Rows)
{
Console.WriteLine(String.Format("{0} {1}",
dr["Marke"], dr["Typ"]));
}
}
}
}
}
}
}
}

Die Datei ist auch zum Herunterladen verfügbar. Erweiterungen kann jeder selbst vornehmen. :)

Die ODBC-Verbindung muss natürlich vorhanden sein. Man erstellt sie unter Windows mithilfe des "Data Sources (ODBC)" Administrative Tool ("%SystemRoot%\system32\odbcad32.exe"). Folgen Sie den Anweisungen, drücken Sie "Weiter", akzeptieren Sie die Allgemeinen Geschäftsbedingungen für die Einrichtung einer Datenbankverbindung.

WCF Service Error (Silverlight 2 Development)

Dienstag, Mai 27th, 2008

While working with Silverlight 2 Beta 1 and a WCF Service as the data source, I received the following error (with a different messy filename of course):

Could not load file or assembly 'App_Web_sjsnnzu9, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

This issue can be solved with the following change in the web.config file:

<compilation debug="true" batch="false">

The important part is the "batch=false". See the MSDN "compilation Element (ASP.NET Settings Schema)" for further information about this section. At least it solves the issue so far. :)

Thank you to Olivier who wrote a comment on a post in Rick Strahl's Web Log.

IEEE 802.1X authentication mit SP3: "Wired AutoConfig" (PEAP)

Dienstag, Mai 20th, 2008

Am Wochenende Service Pack 3 (Windows XP) installiert, und Mittwoch in der Schule erstmal kein Internet. Sonst allerdings habe ich noch keine Probleme mit dem Update bemerkt.

Mein Problem war, dass die Authentifizierung am Netzwerk nicht mehr geklappt hat, und das "Authentication"-Tab im Eigenschaften-Dialog der Local Area Network (LAN) Connection weg war. Dies lag daran, dass mit Service Pack 3 der "Wired AutoConfig" Service eingeführt wurde, welcher die Authentifizierung vornimmt: "This service performs IEEE 802.1X authentication on Ethernet interfaces".

Local Area Connection Properties Screenshot

Service gestartet, per default stand er auf "manual". Alles super. Nur wissen muss man das...

Gewohnt anders.

Sonntag, Mai 4th, 2008

Ein Bild zum Slogan, zitiert von der IKEA-Webseite. Proudly powered by Vorgezogenes Sommerloch(tm).

Laptop auf Klopapier-Grosspackung