Monthly Archives: October 2011

Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF.

This message is raised when you try to insert values in an identity column. Identity columns are auto incremented by the system and thus, does not allow manual modifications/insertions. To resolve this error, you have to set the Column_Identity ON by using the following syntax. SET IDENTITY_INSERT tblXYZ ON — your insert statement here SET […]

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 […]