Introduction to .NET Framework, C# (C Sharp) and Windows Forms

| 2017/10/05 03:59

Microsoft .NET Framework

Microsoft .NET Framework is technology for building and running .NET applications. It provides a standard library of classes and a run-time environment called Common Language Runtime (CLR).CLR is the foundation of the .NET Framework. It manages code at execution time, memory management, thread management, remoting.

c# combobox fill from database

| 2017/10/05 03:18
To get only the unique /distinct/ data table records from any database connected to DataSet in C# project and to put them inside combobox.Fill the table adapter with the records from database.
this.myDBTable_TableAdapter.Fill(this.myDB_DataSet.myDBTable);
Create a view containing the database table
DataView view = new DataView(this.myDB_DataSet.myDBTable);

Copy only the distinct records to new data table.
TAGS:

Get latest date record - SQL query

| 2017/10/05 03:02
To return the latest record (one record only) from data base table where one of the fields is in Date/Time format:
SELECT TOP 1 * FROM table_name ORDER BY date_time_column_name DESC
Notes:
TAGS:

c# combobox set selected item by item's text

| 2017/10/05 02:52
C# Combobox defined with name my_combobox
private System.Windows.Forms.ComboBox my_combobox;

Define string variable with the text of the combobox item that has to be selected. For example, if the combobox items have text values "item_a" "item_b" "item_c" ... and the item which text is "item_b" has to be selected
TAGS: |

C# - Get database connection string from Web.config file

| 2017/10/05 02:45

To get the database connection string from IIS Web.config file using C# code, include System.Configuration directive and then create a string variable to assign the connection string like this:
using System.Configuration;
string connStr = ConfigurationManager.
                  ConnectionStrings["connectionString_Name"].ConnectionString;
If “ConfigurationManager” is not recognized you will need to add reference to: "System.Configuration".See: C# - How to add reference to project

TAGS: |