设置绑定DGV的数据的默认值 [英] Setting a default value of data binded DGV

查看:111
本文介绍了设置绑定DGV的数据的默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿。



我从这开始我是C#和WinForms的新手所以如果需要请像对待白痴一样对待我尽可能简单地解释事情:)。



所以..最近我开始了一个新项目,它包含绑定到SQL Server Table的DGV。当用户添加新行时,我想在他向DB创建新行时传递有关他的登录和日期的信息。



我在表格中创建了2列 - UsrCrt和DtCrt。我已经发现要通过创建日期我应该只是DateTime.Now,对于Windows用户我应该使用System.Security.Principal.WindowsIdentity.GetCurrent()。名称。



但是,我真的不知道如何将这些作为DGV新行的默认值。

Hey.

I'd start with this that I'm pretty new to C# and WinForms so if needed please treat me like an idiot if it's necessary to explain things the easiest way possible :).

So.. Recently I started a new project, it contains DGV which is binded to SQL Server Table. When user adds new row I'd like to pass information about his login and date when he created new row into DB.

I created in my table 2 columns - UsrCrt and DtCrt. I already found out that to pass the creation date I should simply just DateTime.Now, and for Windows user I should use System.Security.Principal.WindowsIdentity.GetCurrent().Name .

However, I don't really have an idea how should I put those as default values for DGV new row.

推荐答案

当你创建新的时候行,将数据添加到该行的列中。
When you creat the new row, add data into the columns of that row.


这篇关于设置绑定DGV的数据的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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