Home All Groups Group Topic Archive Search About

dAdapter.FillSchema vs dAdapter.Fill with dataset.clear?

Author
12 Sep 2006 12:41 PM
Rich
Hello,

I want to use a dataAdapter to insert rows into a table on a sql server DB. 
I understand that the DataAdapter will automatically handle concurrency
issues.  So first I have to get a table to insert a row into.  I have been
doing this:

da.SelectCommand = New SqlCommand("Select * from tbl1", conn)
da.FillSchema(ds, SchemaType.Source, "tbl1")
....
my other method was this:

da.SelectCommand = New SqlCommand("Select * from tbl1", conn)
da.Fill(ds, "tbl1")
ds.Clear

I read one post of someone who said that the Fillschema method used more
resource than the Fill method.  But I am thinking, what if I already have a
ton of rows in the table?  I only need the schema of the table to insert a
new row into.  Any suggestions appreciated which method is the best practice
- or if neither method above is best practice - what would be a best practice
method?

Thanks,
Rich

Author
13 Sep 2006 4:05 AM
rowe_newsgroups
> Any suggestions appreciated which method is the best practice
> - or if neither method above is best practice - what would be a best practice
> method?

Can you elaborate on what exactly you need to accomplish?

> I want to use a dataAdapter to insert rows into a table on a sql server DB.

Also is tbl1 in the same SQL server db that you are wanting to insert
rows into?

Thanks,

Seth Rowe

Rich wrote:
Show quoteHide quote
> Hello,
>
> I want to use a dataAdapter to insert rows into a table on a sql server DB.
> I understand that the DataAdapter will automatically handle concurrency
> issues.  So first I have to get a table to insert a row into.  I have been
> doing this:
>
> da.SelectCommand = New SqlCommand("Select * from tbl1", conn)
> da.FillSchema(ds, SchemaType.Source, "tbl1")
> ...
> my other method was this:
>
> da.SelectCommand = New SqlCommand("Select * from tbl1", conn)
> da.Fill(ds, "tbl1")
> ds.Clear
>
> I read one post of someone who said that the Fillschema method used more
> resource than the Fill method.  But I am thinking, what if I already have a
> ton of rows in the table?  I only need the schema of the table to insert a
> new row into.  Any suggestions appreciated which method is the best practice
> - or if neither method above is best practice - what would be a best practice
> method?
>
> Thanks,
> Rich