| |

VerySource

 Forgot password?
 Register
Search
View: 677|Reply: 2

Ask about the method of filling the DataTable

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-29 15:20:01
| Show all posts |Read mode
In DotNet, there are two ways to access the database, read the data and generate a DataTable.
Take access to MS-SQL Server as an example:
One. Filling the DataTable with the Fill method in the SqlDataAdapter class
two. Use the SqlDataCommand class to generate an instance of the SqlDataReader class, then use the GetSchemaDTable method in the SqlDataReader class to return a DataTable
What's the difference between these two methods?
Which method performs better?
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-8 17:00:01
| Show all posts
GetSchemaTable returns the metadata of the column, but also calls Read () of SqlDataReader
Method to get all records.
The fill method of SqlDataAdapter is also essentially reading all records using SqlDataReader.
There is essentially no difference.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-17 17:00:01
| Show all posts
It depends on the situation
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list