如何在数据库中保存datagridview null值,并将插入的值保存在数据库中 [英] How to save datagridview null values in the datbase and also save inserted values in the database

查看:113
本文介绍了如何在数据库中保存datagridview null值,并将插入的值保存在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行模式屏幕如下;保存(按钮)



日期会议CK RK MK Gs VB SJ



2013年1月1日1 REO PH2 TFC







日期基础设计如下;



日期日期时间

会话编号

课程文本

Faculty_Code文件



在数据库中我想保存上面的输出,如下所示;



日期会话课程Faculty_Code

1/1/2013 1 REo CK

1/1/2013 1 PH2 RK

2013年1月1日1 TFC MK

1/12013 1 GS

1/12013 1 VB

1/1/2013 1 Sj



i保存了数据库中的插入值吧工作中。我想在数据库中保存空值。



它是一个使用c sharp的Windows应用程序。



我该怎么办。



当我点击保存按钮输出时我在datagridview中已经如下所示;





日期会议课程Faculty_Code

2013年1月1日1 REo CK

2013年1月1日1 PH2 RK
2013年1月1日1 TFC MK



然后我想在数据库中也为null值如下。



1/12013 1 GS

1/12013 1 VB

1/1/2013 1 Sj

Run Mode screen as follows; Save(Button)

Date Session CK RK MK Gs VB SJ

1/1/2013 1 REO PH2 TFC



Date Base Design as follows;

Date Datetime
Session number
Course Text
Faculty_Code Text

In database i want to save the above output as follows;

Date session Course Faculty_Code
1/1/2013 1 REo CK
1/1/2013 1 PH2 RK
1/1/2013 1 TFC MK
1/12013 1 GS
1/12013 1 VB
1/1/2013 1 Sj

i saved the insert values in the database it is working. i want to save null values in the database.

it is a windows application using c sharp.

how can i do.

when i click the save button output i get already as follows in datagridview;


Date session Course Faculty_Code
1/1/2013 1 REo CK
1/1/2013 1 PH2 RK
1/1/2013 1 TFC MK

Then i want to null values also in the database also as follows.

1/12013 1 GS
1/12013 1 VB
1/1/2013 1 Sj

推荐答案

您需要使用查询来保存数据库中的数据。



保存空值

1)确保表中的列允许保存空值。

2)继续使用查询在这些字段中保存值。
You need to use a query to save data in the database.

To save null values
1) Make sure the columns in the tables allow saving nulls.
2) Go ahead and save values in these fields using the query.


这篇关于如何在数据库中保存datagridview null值,并将插入的值保存在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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