August 2008 Entries

Select "Both Relation and Foreign Key Constraint" when creating relationship in VS Dataset designer.

MS VS Dataset Designer allows to create a relationship (a DataRelation object) that maintains information about parent-child records in two data tables in a dataset using Relation Dialog Box. It has option to specify type of relationship: Both Relation and Foreign Key Constraint Creates both a relation and foreign key constraint (see below for descriptions). Foreign Key Constraint Only A ForeignKeyConstraint restricts the action performed when a value in a column (or columns) is either deleted or ......

Javascript to re-calculate summary based on user drop-down lists selections

I wanted to implement client javascript to re-calculate summary based on a few options(in drop-down lists) selected by the user . The closest JS sample I found was Complex Client-Side Shopping Cart .But it wasn't exactly what I wanted. I created an array of custom class objects. Class has InitialPrice and SelectedPrice properties as well as this.Diff = function( ) { return this.SelectedPrice-this.Ini... } Each DropDownList calls onchange Event Handler, which updates SelectedPrice value and ......

Developer should not use "Hide extensions for known file types" in Windows Explorer

One my colleague got a new PC and had a problem opening file using simple code(just from MSDN example ): FileInfo fi1 = new FileInfo(relativePath); if (!fi1.Exists) .... It showed that file doesn't exist. We've tried also File.Exists(relativePath), changed the path to absolule- the same result- file is visible in Windows Explorer, but doesn't exist in code. Note that directory was shown in debugger as existing. We've created(using Windows Explorer) a new Text file, named "test.txt" and tried to open ......

Convert DataSet and DataTable to Xml String helper functions

I created 2 helper functions(can be modified as extensions in .Net Framework 3.5) to output/trace content of DataSet or DataTable public static string ToStringAsXml(DataSet ds) { StringWriter sw = new StringWriter(); ds.WriteXml(sw, XmlWriteMode.IgnoreSchema); string s = sw.ToString(); return s; } public static string ToStringAsXml(DataTable dt) { StringWriter sw = new StringWriter(); dt.WriteXml(sw, XmlWriteMode.IgnoreSchema); string s = sw.ToString(); return s; } ......