DotNetWorld logo

c#

Add parameters to a dataset
switch statement with multiple options
Accessing Values of a typed Dataset
Members of a system object
Declaring a nullable integer
Getting the Windows User Id
Replacing Apostrophes in a string

C# syntax for adding 2 parameters to a fill dataset command prompt

New sqlparameter("@sysTerritoryid, territoryid), new sql parameter("@param2",param2)}"spname" etc

Switch statement with multiple options having the same result

case 1: case 2: case 3: Do Something; break; case 4:

Accessing the value of a typed dataset

this.DataSetName.TableName[RowIndex].FieldName

members of System.Object

public virtual bool Equals(object) - returns true if the object supplied or a parameter is equal in value, not necessarily in reference
public static bool ReferenceEquals(object a, object b) - returns true if both parameters refer to the same object

Declaring nullable integer

Nullable< int > i=null;

Getting windows User id

using system.security.principal; string a; a = system.security.principal.windowsidentity.getcurrent().Name.ToString(); MessageBox.Show(a.ToString());

Replacing Apostrophes

this.txtSubLabel.Text.Trim().Replace("'","""); This stuff is in the sidebar

// // // //