C# 在winform上显示来自sql server的表
我正在使用 C# 连接到 sql 服务器。如何在 winform 上显示以下查询的结果?我想在控件中显示此数据集。我相信它应该是一个数据图表,但这对我来说并不重要。
// Initialize a connection string
string myConnectionString = "Provider=SQLOLEDB;Data Source=hermes;" +
"Initial Catalog=qcvaluestest;Integrated Security=SSPI;";
// Define the database query
string mySelectQuery = "select top 500 name, finalconc " +
"from qvalues where rowid between 0 and 25000";
在 winform 上显示此查询结果的最佳方式是什么?
I am connecting to sql server using c#. How do I display the results of the below query on a winform? I would like to display this data set in a control. I believe it should be a datachart, but it does not matter to me.
// Initialize a connection string
string myConnectionString = "Provider=SQLOLEDB;Data Source=hermes;" +
"Initial Catalog=qcvaluestest;Integrated Security=SSPI;";
// Define the database query
string mySelectQuery = "select top 500 name, finalconc " +
"from qvalues where rowid between 0 and 25000";
What is the best way to display the results of this query on a winform?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 DataGridView 拖放到表单上,然后使用此代码填充它
Drop a DataGridView on your form, and use this code to populate it