470,628 Members | 2,298 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,628 developers. It's quick & easy.

SqlDataSource Data, Can not get to it

LVP
Hi,

I have a sqldatasource01 configured properly and can databind it to a
CheckBoxList and see data with no problem.

How can I get the data programmatically from the sqldatasource01
I need to loop through it. and get the extra columns passed in the
sqldatasource01
I don't want to loop through the CheckBoxList because it does not have all
the extra columns.

Can I do this with one sqldatasource and not two.

help

thanks

LVP

Jan 3 '08 #1
2 1260
On 3 Jan, 19:47, "LVP" <lvp_agent...@hotmail.comwrote:
Hi,

I have a sqldatasource01 configured properly and can databind it to a
CheckBoxList and see data with no problem.

How can I get the data programmatically from the sqldatasource01
I need to loop through it. and get the extra columns passed in the
sqldatasource01
I don't want to loop through the CheckBoxList because it does not have all
the extra columns.

Can I do this with one sqldatasource and not two.

help

thanks

LVP
Hi

The SqlDataSource component is really for binding directly to web
server controls at design time to save coding. I think you'll find
that the internal data structures of those components aren't really
accessible in code.

If you require programmatic access to SQL data tables (and you don't
want to write reams of code using the traditional components in the
System.Data.SqlClient name space) then try adding a DataSet to the
project. A wizard will take you through the process of setting up a
TableAdapter (a new version of the old SqlDataAdapter) and DataTable
defined in an XSD file (which by default will go in the App_Code
folder).

New namespaces will be added to your project containing objects for
the TableAdapter and DataTable which can be created and used as
required (DataViews then can be created and used in the normal
manner). Whatever columns you require can be exposed in the Select
statement (the wizard can bring up QueryBuilder if you wish to
construct it visually). The DataTable can also be used as the
datasource for the CheckBoxList if you like so that only one
datasource is used, but the binding process will require some
programmatic intervention. Try it and see.

Jan 3 '08 #2
LVP
Phil,

I will follow your recommendations and see where I get stuck next.

I appreciate you taking the time to explain this.

much thanks,

LVP
"Phil H" <go****@philphall.me.ukwrote in message
news:bd**********************************@i12g2000 prf.googlegroups.com...
On 3 Jan, 19:47, "LVP" <lvp_agent...@hotmail.comwrote:
>Hi,

I have a sqldatasource01 configured properly and can databind it to a
CheckBoxList and see data with no problem.

How can I get the data programmatically from the sqldatasource01
I need to loop through it. and get the extra columns passed in the
sqldatasource01
I don't want to loop through the CheckBoxList because it does not have
all
the extra columns.

Can I do this with one sqldatasource and not two.

help

thanks

LVP

Hi

The SqlDataSource component is really for binding directly to web
server controls at design time to save coding. I think you'll find
that the internal data structures of those components aren't really
accessible in code.

If you require programmatic access to SQL data tables (and you don't
want to write reams of code using the traditional components in the
System.Data.SqlClient name space) then try adding a DataSet to the
project. A wizard will take you through the process of setting up a
TableAdapter (a new version of the old SqlDataAdapter) and DataTable
defined in an XSD file (which by default will go in the App_Code
folder).

New namespaces will be added to your project containing objects for
the TableAdapter and DataTable which can be created and used as
required (DataViews then can be created and used in the normal
manner). Whatever columns you require can be exposed in the Select
statement (the wizard can bring up QueryBuilder if you wish to
construct it visually). The DataTable can also be used as the
datasource for the CheckBoxList if you like so that only one
datasource is used, but the binding process will require some
programmatic intervention. Try it and see.

Jan 4 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Martin Bischoff | last post: by
3 posts views Thread by zapov | last post: by
1 post views Thread by Mike P | last post: by
5 posts views Thread by msch-prv | last post: by
6 posts views Thread by djc | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.