开发者

Is it possible for a user to reference a previously created datatable by entering a string?

I want a quick way to be able to see all of the data that is currently in a DataTable. I want to be able to reference the name of the DataTable by entering string into a TextBox, have my program recognise that it's a DataTable that has data in it, and display that data in a 开发者_JAVA技巧DataGridView. Maybe this isn't the best approach but it's better than creating a Select Case scenario for each datatable I've created. Any ideas?


I think you should probably find a more robust way to do this. However, if you really do wish to use this model, you can associate a string to a DataTable using Dictionary<string, DataTable>. Look up the entered string (making sure to handle cases in which the string is not found) among the dictionary keys, and you'll have your DataTable.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜