isisun photos
Categories
Charts
Visitors
Category Archives: C#
Binding DatagridView to DataTable Snippets
String strConn = “Server = .\\sqlexpress;Database = NorthWind;Integrated Security = SSPI;”;
dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
conn = new SqlConnection(strConn);
da = new SqlDataAdapter(“Select Categories.CategoryName, Products.ProductName, Products.UnitPrice From Categories Inner Join Products on Products.CategoryID = Categories.CategoryID”, conn);
SqlCommandBuilder cmd = new SqlCommandBuilder(da);
ds = new DataSet();
da.Fill(ds, “Categories”);
bs = new BindingSource(ds, “Categories”);
dataGridView1.DataSource = bs;
bindingNavigator1.BindingSource = bs;
[Translate]
Setting FileSystemWatcher
I have to watch for changes in INI file so needed somehow to put an event which should trigger an action in my program.FileSystemWatcher class is exactly what I needed.It’s easy to use and very helpful so I will paste the codesnippet that I have found:
/*
* C# Programmers Pocket Consultant
* Author: Gregory S. MacBeth
* [...]

Insert/Read image from SQL Database