|
-
Sep 7th, 2004, 05:26 AM
#1
Thread Starter
Fanatic Member
Copying a datasource()
I bind a table to a drop down called "ddList".
I now want to make a table = the datasource of the "DDList".
Is this possible ?
-
Sep 7th, 2004, 06:52 AM
#2
I wonder how many charact
Datasource properties take an object (probably reference)...
So if you were to assign a datasource to a dropdownlist and your other table in a fell swoop like so...
VB Code:
Dim copyDataTable As DataTable
copyDataTable = myDataTable.Copy()
me.dropdownlist1.datasource = myDatatable
me.dropdownlist1.databind
you should be ok..
-
Sep 7th, 2004, 07:02 AM
#3
Thread Starter
Fanatic Member
Does copying the table also copy all the rows ?
-
Sep 7th, 2004, 10:22 AM
#4
Addicted Member
I believe the Copy method only copies the data structure, I don't think it copies any of the data over.
My question would be why are you want to get the datasource of ddlist when you have already got the original datatable in memory?
If you are wanting to access the datatable outside the original function/procedure/event then why not declare it as public (if on webform) or pass it to the function.
-
Sep 7th, 2004, 11:14 AM
#5
I wonder how many charact
DataTable.Copy copies both the schema and the data.
But along the lines of what rdove suggested... not declaring it public of course...
If the original datasource is a table... you could set both objects to the same table. However, if ones changes the underlying table, then a copy is of course recommended if you do not want changes to appear in both places.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|