如何显示数据库表? [英] How to display database table ?

查看:90
本文介绍了如何显示数据库表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了表格,但是如何在Windows窗体中显示数据库表



I have created table, but How can i display database table in Windows Form ?

SqlConnection sqlconn = new SqlConnection("Data Source=AAN-PC;Initial Catalog=friday;Integrated Security=True");
                        SqlDataAdapter sa = new SqlDataAdapter();

                        string query = "insert into Table_1(SensorID,SensorValue,Time) values(@AB, @SV, @TM)";
                        sa.InsertCommand = new SqlCommand(query, sqlconn);

                        sa.InsertCommand.Parameters.AddWithValue("@AB", id);
                        sa.InsertCommand.Parameters.AddWithValue("@SV", hexValue);
                        sa.InsertCommand.Parameters.AddWithValue("@TM", DateTime.Now.ToString("HH:mm:ss"));

推荐答案

HI,



查看以下链接以windows格式显示表格:

将表和列添加到Windows窗体DataGrid控件

c#windows form app中的表格

http://bytes.com/topic/c-sharp/answers/940680-display- google-map-windows-form [ ^ ]



如何刷新数据网格:

刷新网格以获取更新的数据



谢谢


Check out the following link to display the table in windows form:
Adding Tables and Columns to the Windows Forms DataGrid Control
Table in c# windows form app
http://bytes.com/topic/c-sharp/answers/940680-display-google-map-windows-form[^]

How to refresh the datagrid:
Refreshing the grid for updated data

Thanks


这篇关于如何显示数据库表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆