开发者

Proper way of connecting to a dynamic data source

Which technology should I use for data access layer?

What's the best way of connecting to a dynamic data source and binding the result to a grid?

I'm writing a little web app that user can define connection string and table name (MS Sql Server) and the program will display values in that table inside a grid.

We must use datasets (because of dynamic data source) and generate the query as a text command ("Select * From " + TableName).

We don't have a model (data source is defi开发者_JS百科ned by user at run time) so we can not use EF.

What do you think? Should I use datasets? Is there any better solution out there?

I'm not looking for a sample code here. I'm looking for the best way of connecting to data source.


"Should I use datasets?"

I don't see why not. They are easy to code against, and can bind to gridviews and repeaters easily. They can be populated using text queries as well. Though I would caution you against SQL injection attacks. So if you do go the way of the text SQL commands make sure to scrutinize the user input.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜