create controlls dynamically and fill from database


hai friends 

i have 1 query   like

select txt1,blob1,blob2,blob3 address  txt1='500'";   have data

i need create in c# controlls dynamically in c# from

and fill data query after creating these controlls in c# form

how can create these controlss dynamically , fill data 

regards

hotn thought

hello,

to create controls use data provider such sqlclient or oledb. use oldedbcommand , oledbreader or sqlclientcommand , sqlclientreader , populate datatable. row count datatable , use statement loop thru results. datacolumns have property type , somehow decide how handle loading data.

simple static example of creating controls dynamically no regard above, need adapt working datatable.

int topindexer = 40; (int x = 0; x <= 4; x++) {     textbox tb = new textbox { name = "textbox" + x.tostring(), top = topindexer + x, left = 20 };     this.controls.add(tb);     topindexer += 40; }

now use ide data wizards in tangent datagridview and/or static controls can traversed bindingsource coupled bindingnavigator. noting have blob (or @ least appears have blob data), need determine best control data , use methods of data provider retrieve said data.

be 1 row or multiple rows being returned better off not going dynamic, best stay ide data wizards work data context class or entity framework unless there compelling reason not , reason should not lack of understanding them microsoft has deal of documentation can had via web search.


please remember mark replies answers if , unmark them if provide no help, others looking solutions same or similar problem.



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'