单击加载按钮时显示数据网格视图记录 [英] show the data grid view records when i click the load button
问题描述
在datagridview中运行模式屏幕如下;加载(按钮)
i有一个名为Load的按钮。
日期会话NR PN GS
28-Jan 1 REO PH2 TASCO
28-Jan 2
28-Jan 3
28-Jan 4
29-Jan 1
29-Jan 2 AFF MFA CTF
29-Jan 3
29-Jan 4
30-Jan 1
30-Jan 2
30-Jan 3 TFC LGTF ECDIS
30-Jan 4
31-Jan 1
31-Jan 2
31-Jan 3
31-Jan 4 ERSM ARPA REO
1-Feb 1 PH2 TASCO AFF
1-Feb 2
1-Feb 3
1-Feb 4
2-Feb 1
2-Feb 2 MFA CTF TFC
2-Feb 3
2-Feb 4
所有上述详细信息都在datagridview中输入并保存在数据库中。
它工作正常没问题。
然后我今天关掉我的系统。
第二天我操作在我的项目中运行这个屏幕。
当我点击加载按钮前一天在datagridview中输入的所有数据'我将在datagridview中显示数据。
我该如何编写代码。请帮助我。
数据库设计如下;
Sch_Date日期/时间
会话编号
课程文字
Faculty_Code Text
Tablename Schedule。
在日程表中保存所有细节在数据库中。
当我点击加载按钮输出时如下;
日期会话NR PN GS
28-Jan 1 REO PH2 TASCO
28-Jan 2
28-Jan 3
28-Jan 4
29-Jan 1
29-Jan 2 AFF MFA CTF
29-Jan 3 br />
29-Jan 4
30-Jan 1
30-Jan 2
30-Jan 3 TFC LGTF ECDIS
30-Jan 4
31-Jan 1
31-Jan 2
31-Jan 3
31-Jan 4 ERSM ARPA REO
1-Feb 1 PH2 TASCO AFF
1-Feb 2 >
1-Feb 3
1-Feb 4
2-Feb 1
2-Feb 2 MFA CTF TFC
2-Feb 3
2-Feb 4
我该怎么办? ?我怎么能写代码。请帮助我。
谢谢&Rgds,
Narasiman P
Run mode screen in datagridview as follows; Load(Button)
i have one button called Load.
Date Session NR PN GS
28-Jan 1 REO PH2 TASCO
28-Jan 2
28-Jan 3
28-Jan 4
29-Jan 1
29-Jan 2 AFF MFA CTF
29-Jan 3
29-Jan 4
30-Jan 1
30-Jan 2
30-Jan 3 TFC LGTF ECDIS
30-Jan 4
31-Jan 1
31-Jan 2
31-Jan 3
31-Jan 4 ERSM ARPA REO
1-Feb 1 PH2 TASCO AFF
1-Feb 2
1-Feb 3
1-Feb 4
2-Feb 1
2-Feb 2 MFA CTF TFC
2-Feb 3
2-Feb 4
all the above details are entered in the datagridview and save it in the database.
it is working fine no problem.
then i switch off my system today.
Next day i open my project and run this screen.
when i click the Load button all the data''s i entered in the datagridview in the previous day that data''s to be shown in the datagridview.
for that how can i write the code.please help me.
Database Design as follows;
Sch_Date Date/Time
Session Number
course Text
Faculty_Code Text
Tablename Schedule.
in the schedule table all the details are saved in the database.
when i click the load button output as follows;
Date Session NR PN GS
28-Jan 1 REO PH2 TASCO
28-Jan 2
28-Jan 3
28-Jan 4
29-Jan 1
29-Jan 2 AFF MFA CTF
29-Jan 3
29-Jan 4
30-Jan 1
30-Jan 2
30-Jan 3 TFC LGTF ECDIS
30-Jan 4
31-Jan 1
31-Jan 2
31-Jan 3
31-Jan 4 ERSM ARPA REO
1-Feb 1 PH2 TASCO AFF
1-Feb 2
1-Feb 3
1-Feb 4
2-Feb 1
2-Feb 2 MFA CTF TFC
2-Feb 3
2-Feb 4
how can i do?how can i write the code.please help me.
Thanks & Rgds,
Narasiman P
推荐答案
点击加载按钮尝试下面的代码
Try below code on click of Load button
string query = "SELECT * FROM Person";
SqlDataAdapter da = new SqlDataAdapter(query, connection);
SqlCommandBuilder cb = new SqlCommandBuilder(da);
DataTable dt = new DataTable();
da.Fill(dt);
BindingSource bs = new BindingSource();
bs.DataSource = dt;
dataGridView1.DataSource = bs;
这篇关于单击加载按钮时显示数据网格视图记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!