[LINQ] The query results cannot be enumerated more than once (using databinding…)
When you bind the ISingleResultfor the first time, the results are enumerated and the data object is populated. When you bind the same ISingleResult instance to the same control again, it detects that the data-source is the same as its last source (by comparing their object references) and does not enumerate the ISingleResult instance for […]
Introducing Crystal Reports
With the release of Visual Studio.NET 2003, Microsoft finally woke up to the needs of developers. They licensed Crystal Decisions to write a version of Crystal Reports to be the default reporting solution installed with .NET. Built into the IDE, Windows developers now have the tools to write presentation-quality interactive reports. More on : Introducing […]
PInvoke.net : Far beyond managed code (DllImport inside)
PInvoke.net is primarily a wiki, allowing developers to find, edit and add PInvoke* signatures, user-defined types, and any other information related to calling Win32 and other unmanaged APIs from managed code (written in languages such as C# or VB.NET). sample code : [DllImport(“aygshell.dll”)] static extern uint SHRecognizeGesture(ref SHRGINFO shrg); [StructLayout(LayoutKind.Sequential)] class SHRGINFO { public uint […]
How to upload a .SQL file to a Hoster and Execute it to Deploy a SQL Database
How to upload a .SQL file to a Hoster and Execute it to Deploy a SQL Database @ ScottGU BLOG
Dynamic where clause using Linq To SQL
var query = from c in context.Customers select c; if (name != null) query = query.Where ( customer => customer.Name == name ); if (contactName != null) query = query.Where ( customer => customer.ContactName == contactName ); This way we can pass different combinations of arguments to the method and it will still build the […]
Linq to SQL Like Operator
Starting from a simple query from Northwind Database; var query = from c in ctx.Customers where c.City == “London” select c; The query that will be sent to the database will be: SELECT CustomerID, CompanyName, … FROM dbo.Customers WHERE City = [London] There are some ways to write a Linq query that results in using […]
Winforms Textbox Autocomplete in c# using Linq
xyzDataContext dc = new xyzDataContext(); AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection(); var query = from c in dc.Clients select c.Company; foreach (String comp in query) { namesCollection.Add(comp); } tBoxCompany.AutoCompleteSource = AutoCompleteSource.CustomSource; tBoxCompany.AutoCompleteMode = AutoCompleteMode.SuggestAppend; tBoxCompany.AutoCompleteCustomSource = namesCollection; Result => AutoCompleteMode accept thoose values : External link : AutoComplete TextBox In WinForms AutoComplete TextBox in C#
DataGridView datasource : Use BindingSource or direct query ???
LINQ to SQL translates LINQ queries to SQL for execution on a database. The results are strongly typed IEnumerable. Because these objects are ordinary common language runtime (CLR) objects, ordinary object data binding can be used to display the results. On the other hand, sorting and change operations (inserts, updates, and deletes) require additional steps. […]
C# SFTP library
Libraries for accessing a SFTP server (FTP over SSH) using C# are not included in the framework ((not yet?)). Anyway, some snippets or libraries are available for free on the internet. I will list two of them : – SharpSSH SharpSSH is quite a good library, standalone, that implement the jsch library. – SFTP using […]
[HowTo] Application start on “Wake up” event
Using this code will allow you to configure your application to start or to display following a system wakeup event. /// <summary> /// This function starts running an application when a specified event occurs. /// </summary> /// <param name=”application”>The application. eg: @”\Program Files\testapp\testapp.exe”</param> /// <param name=”notificationEvent”>Event at which the application is to be started. Use […]