数据集列中数据库的Defaultvalue [英] Defaultvalue from database in dataset columns

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

问题描述




我有一个Access数据库,我在其中定义了某些

列的默认值。在我的Windows窗体上,我有绑定到数据集的控件,

问题是,当我向数据集添加一个新行时,我的控件没有

在数据库中输入的默认值。


是否可以从

数据库中检索列的默认值?

-

遇见vriendelijke groet /问候/ Saludos,

Moviat Automatisering

Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl


电话:+31 162 470 534

传真:+31 162 470 502

Hi,

I have an Access database in which I defined default values for certain
columns. On my windows forms I''ve got controls bound to the dataset, The
problem is that when I add a new row to the dataset my controls don''t have
the defaultvalue entered in the database.

Is it possible to retrieve the defaultvalue for the column from the
database?
--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering
Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
fax: +31 162 470 502

推荐答案

Datacolumn对象有一个defaultvalue属性..假设你的

Db中名为FirstCol的Column1的默认值为" 1 QUOT;在Access ..


假设FirstCol是SQL查询中的第一个字段..


myDataSet.Tables [" MyTable"]。列[0] .DefaultValue =" 1"


您可以在本地为每一个执行此操作,以使其与数据库中的默认值相匹配。

" Maurice Mertens < mauricem@moviat_KillSpamWordForEMail.nl>在消息中写道

news:Xn **************************** @ 207.46.248.16。 ..
The Datacolumn object has a defaultvalue property.. Say that Column1 in your
Db named FirstCol has a defaultvalue of "1" in Access..

assuming FirstCol was the first field in your SQL Query..

myDataSet.Tables["MyTable"].Column[0].DefaultValue = "1"

You can do that for each one locally so it matches your defaults in the db.
"Maurice Mertens" <mauricem@moviat_KillSpamWordForEMail.nl> wrote in message
news:Xn****************************@207.46.248.16. ..


我有一个Access数据库,我在其中定义了某些
列的默认值。在我的Windows窗体上,我有一些绑定到数据集的控件,问题是当我向数据集添加一个新行时,我的控件没有输入数据库中的defaultvalue。

是否可以从
数据库中检索列的默认值?

-
Met vriendelijke groet /关于/ Saludos,
Moviat Automatisering

Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

电话:+31 162 470 534
传真:+31 162 470 502
Hi,

I have an Access database in which I defined default values for certain
columns. On my windows forms I''ve got controls bound to the dataset, The
problem is that when I add a new row to the dataset my controls don''t have
the defaultvalue entered in the database.

Is it possible to retrieve the defaultvalue for the column from the
database?
--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering
Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
fax: +31 162 470 502



Datacolumn对象有一个defaultvalue属性..假设Column1 in你名为FirstCol的
Db的默认值为1。在Access ..


假设FirstCol是SQL查询中的第一个字段..


myDataSet.Tables [" MyTable"]。列[0] .DefaultValue =" 1"


您可以在本地为每一个执行此操作,以使其与数据库中的默认值相匹配。

" Maurice Mertens < mauricem@moviat_KillSpamWordForEMail.nl>在消息中写道

news:Xn **************************** @ 207.46.248.16。 ..
The Datacolumn object has a defaultvalue property.. Say that Column1 in your
Db named FirstCol has a defaultvalue of "1" in Access..

assuming FirstCol was the first field in your SQL Query..

myDataSet.Tables["MyTable"].Column[0].DefaultValue = "1"

You can do that for each one locally so it matches your defaults in the db.
"Maurice Mertens" <mauricem@moviat_KillSpamWordForEMail.nl> wrote in message
news:Xn****************************@207.46.248.16. ..


我有一个Access数据库,我在其中定义了某些
列的默认值。在我的Windows窗体上,我有一些绑定到数据集的控件,问题是当我向数据集添加一个新行时,我的控件没有输入数据库中的defaultvalue。

是否可以从
数据库中检索列的默认值?

-
Met vriendelijke groet /关于/ Saludos,
Moviat Automatisering

Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

电话:+31 162 470 534
传真:+31 162 470 502
Hi,

I have an Access database in which I defined default values for certain
columns. On my windows forms I''ve got controls bound to the dataset, The
problem is that when I add a new row to the dataset my controls don''t have
the defaultvalue entered in the database.

Is it possible to retrieve the defaultvalue for the column from the
database?
--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering
Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
fax: +31 162 470 502



Hi William,


确实可以手动设置它们但是.NET

是否可以使用

defaultvalue自动设置窗体上控件的默认值来自数据库。


这是因为当我更改de数据库中的defaultvalue时,我没有

来编辑我的代码。


" William Ryan eMVP" <做******** @ comcast.nospam.net>写在

news:e5 ************** @ TK2MSFTNGP12.phx.gbl:
Hi William,

Indeed it is possible to set them manually but isn''t it possible for .NET
to set the defaultvalue of the control on the form automatically with the
defaultvalue from the database.

This because when I change the defaultvalue in de database I don''t have
to edit my code.

"William Ryan eMVP" <do********@comcast.nospam.net> wrote in
news:e5**************@TK2MSFTNGP12.phx.gbl:
Datacolumn对象有一个defaultvalue属性..假设名为FirstCol的Db中的Column1
的默认值为1。在Access ..

假设FirstCol是SQL查询中的第一个字段..

myDataSet.Tables [" MyTable"]。Column [0] .DefaultValue =" ; 1

您可以在本地为每个人执行此操作,以便它与数据库中的默认值相匹配。 Maurice Mertens < mauricem@moviat_KillSpamWordForEMail.nl>
在消息新闻中写道:Xn **************************** @ 207.46.248.16 。 ..
The Datacolumn object has a defaultvalue property.. Say that Column1
in your Db named FirstCol has a defaultvalue of "1" in Access..

assuming FirstCol was the first field in your SQL Query..

myDataSet.Tables["MyTable"].Column[0].DefaultValue = "1"

You can do that for each one locally so it matches your defaults in
the db. "Maurice Mertens" <mauricem@moviat_KillSpamWordForEMail.nl>
wrote in message news:Xn****************************@207.46.248.16. ..


我有一个Access数据库,我在其中定义了某些列的默认值。在我的Windows窗体上,我有一些绑定到
数据集的控件,问题是当我向数据集添加一个新行时,我的
控件没有在数据库中输入defaultvalue。

是否可以从
数据库中检索列的默认值?

-
Met vriendelijke groet /关于/ Saludos,
Moviat Automatisering

Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

电话:+31 162 470 534
传真:+31 162 470 502
Hi,

I have an Access database in which I defined default values for
certain columns. On my windows forms I''ve got controls bound to the
dataset, The problem is that when I add a new row to the dataset my
controls don''t have the defaultvalue entered in the database.

Is it possible to retrieve the defaultvalue for the column from the
database?
--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering
Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
fax: +31 162 470 502





-

Met vriendelijke groet / With Concer / Saludos,

Moviat Automatisering

Maurice Mertens
mauricem @ moviat_KillSpamWordForEMail.nl


电话:+31 162 470 534

传真:+31 162 470 502



--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering
Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
fax: +31 162 470 502


这篇关于数据集列中数据库的Defaultvalue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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