sql - C# Approaches to accessing and displaying data from a table -


i need understand merits of using 1 method on another. simplify situation - have textbox.text

needs display field database table. let's have table: table1 1 column, col1.

i can either specify this,

a) textbox1.text = table1["col1"].rows[1] 

or

b) textbox1.databindings.add() method 

can give me comparison of these 2 alternatives, under circumstances should use 1 method on another? there others should aware of? know of linq, understand more alternative sql.

one further aspect not understand. if wanted populate ten textboxes data table, might use like:

for (int =0; i<10; i++) { textbox[i].text = table1["col1"].rows[i]; } 

how accomplished using approach (b)/databinding?

thanks in advance help.

think of databinding "dynamic" in object bound in control change if , when data changes. ideal binding situation bind once ( 2 way ) , forget it.

in other example text set , never change unless explicitly change , likewise if need text data have access text property , value control.

here example in winforms.

http://www.codeproject.com/articles/11530/understanding-simple-data-binding

ms binding explained ( note 0 out of 6 vote )

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.databindings.aspx

another stack overflow simple example

c# textbox data binding dataset


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -