从tableadapter到ACCESS数据库的Problème数据传输 [英] Problème data tramsmission from tableadapter to ACCESS database

查看:51
本文介绍了从tableadapter到ACCESS数据库的Problème数据传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表单上,​​我有一个datagridview。

这个datagridview是在一个由tableadapter填充的数据集上构建的。

表适配器做得很好,它必须做什么填充数据集时。

数据集中的插入,修改和删除功能非常好。

但是无法在ACCESS数据库中传输修改。无法在数据库中写入
WRITE。


这是从tableadapter到Access数据库的数据传输代码




Private Sub ArtistesBindingNavigatorSaveItem_Click(ByVal sender As

System.Object,ByVal e As System.EventArgs)句柄

ArtistesBindingNavigatorSaveItem.Click

尝试

Me.Validate()

Me.ArtistesBindingSource.EndEdit()

Me.ArtistesTableAdapter.Update(我。 StarDvdDataDataS et.artistes)

System.Windows.Forms.MessageBox.Show(" Success!")

Catch ex As Exception

System.Windows.Forms.MessageBox.Show(ex.Message)

结束尝试

结束子


程序说成功!但访问数据库没有任何改变。


可能是我很蠢,但我不明白!


请帮助我。

打扰一下我的英语。我是法国人。

On a form, I have a datagridview.
This datagridview is constructed on a dataset filled by a tableadapter.
The table adapter do very well what it must do when filling dataset.
Insertions, modifications and deletions functions very well in the dataset.
But impossible to transmit modifications in ACCESS database. Impossible to
WRITE in database.

Here is the code for data transmission from tableadapter to Access database
:

Private Sub ArtistesBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ArtistesBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.ArtistesBindingSource.EndEdit()
Me.ArtistesTableAdapter.Update(Me.StarDvdDataDataS et.artistes)
System.Windows.Forms.MessageBox.Show("Success !")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub

Program says "Success !" but nothing has changed in access database.

May be I am stupid, but I don''t understand !

Please help me.
Excuse me for my english. I''m french.

推荐答案

Philip,


没有多少人写 probleme"像你一样做。然而,这是一个国际新闻组,所以即使它不正确我们也能理解很多

英语。


什么你可能需要的只是endcurrentedit,它将数据推送到数据源中的



如果是数据源,可能使用强类型数据集。


BindingContext(StarDvdDataDataSet.artistes).EndCur rentEdit()


我希望这有帮助,


Cor

" philip" < pH值** @ philippe.com> schreef in bericht

news:43 *********************** @ news.wanadoo.fr ...
Philip,

There are not much people who write "probleme" as you do. However this is an
International newsgroup, so we understand a lot even if it is in not correct
English.

What you probably need is just the endcurrentedit, that pushes the data down
in the datasource.

Probably with your strongly typed dataset if that is the datasource.

BindingContext(StarDvdDataDataSet.artistes).EndCur rentEdit()

I hope this helps,

Cor
"philip" <ph**@philippe.com> schreef in bericht
news:43***********************@news.wanadoo.fr...
在表单上,​​我有一个datagridview。
这个datagridview是在tableadapter填充的数据集上构建的。
表适配器在填充数据集时做得非常好。
插入,修改和删除功能在
数据集中非常有用。
但无法在ACCESS数据库中传输修改。无法在数据库中写入。

以下是从tableadapter到Access数据传输的数据代码:

Private Sub ArtistesBindingNavigatorSaveItem_Click(ByVal sender As
System.Object,ByVal e As System.EventArgs)处理
ArtistesBindingNavigatorSaveItem.Click
尝试
Me.Validate()
Me.ArtistesBindingSource.EndEdit()
Me.ArtistesTableAdapter.Update(Me.StarDvdDataDataS et.artistes)
System.Windows.Forms.MessageBox.Show(" Success!")
Catch ex As Exception
System。 Windows.Forms.MessageBox.Show(ex.Message)
结束尝试
结束子

程序说成功!但访问数据库没有任何改变。

可能是我很蠢,但我不明白!

请帮助我。
请原谅我英语。我是法国人。
On a form, I have a datagridview.
This datagridview is constructed on a dataset filled by a tableadapter.
The table adapter do very well what it must do when filling dataset.
Insertions, modifications and deletions functions very well in the
dataset.
But impossible to transmit modifications in ACCESS database. Impossible to
WRITE in database.

Here is the code for data transmission from tableadapter to Access
database :

Private Sub ArtistesBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ArtistesBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.ArtistesBindingSource.EndEdit()
Me.ArtistesTableAdapter.Update(Me.StarDvdDataDataS et.artistes)
System.Windows.Forms.MessageBox.Show("Success !")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub

Program says "Success !" but nothing has changed in access database.

May be I am stupid, but I don''t understand !

Please help me.
Excuse me for my english. I''m french.



感谢您的帮助


我添加了一行:Me.BindingContext( EssaiBindingSource)。EndCurrentEd it()to

尝试Me.EssaiBindingSource.EndEdit()

是不够的:


Private Sub EssaiBindingNavigatorSaveItem_Click(ByVal发送者为

System.Object,ByVal e As System.EventArgs)处理

EssaiBindingNavigatorSaveItem.Click

尝试

Me.Validate()

Me.EssaiBindingSource.EndEdit()

Me .BindingContext(EssaiBindingSource).EndCurrentEd it()

Me.EssaiTableAdapter.Update(Me.Bd11DataSet.essai)

System.Windows.Forms.MessageBox.Show("成功!)

Catch ex As Exception

System.Windows.Forms.MessageBox.Show(ex.Message)

结束尝试< br $>
End Sub


什么都没发生。 Access数据库没有改变。修改始终是好的数据集,但不会传输到Access Dababase。


这一次,我只使用一个只有一个表的数据库

三个字段:1个自动增量字段,ans 2个文本字段。

表中有一行(行)数据,直接在Access中写入

(因为我无法在Visual Studio 2005中执行此操作)。

我创建此数据库专门用于解决我的问题,确保

没有关系困扰过程。


奇怪的事情:

两个文本字段中的一个被声明为唯一(在Access数据库中,

和vsstudio中的数据集结构。

我的表只有一行而我尝试添加新行。如果我写一行

与此唯一字段的第一行相同,我有等待的

消息列''Nom''被限制为唯一的。

如果我在数据集设计器中给这个字段的唯一属性''false'',

让Access表中的唯一,我有Access的消息(用法语,

这是法语版的Access):Risque de doublons。 Access检测到

唯一问题。所以他试着写在数据库中。


但是从Visual Studio 2005写入第二行是不可能的,

即使我给了第二行的好数据(不是唯一的)。

数据集创建行,获取数据,但tableAdapter无法在

数据库中写入。

你是否看到了在数据库中写这种不可能性的另一个原因?


如果微软的某个人可以检查这个问题,欢迎他。因为

今天我不喜欢微软。 - )


" Cor Ligthert [MVP]" <无************ @ planet.nl>一个écritdansle message de

news:e%**************** @ tk2msftngp13.phx.gbl ...
Thanks for uyour help

I added the line : Me.BindingContext(EssaiBindingSource).EndCurrentEd it() to
try if "Me.EssaiBindingSource.EndEdit()
" is not enough :

Private Sub EssaiBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
EssaiBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.EssaiBindingSource.EndEdit()
Me.BindingContext(EssaiBindingSource).EndCurrentEd it()
Me.EssaiTableAdapter.Update(Me.Bd11DataSet.essai)
System.Windows.Forms.MessageBox.Show("Success !")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub

Nothing happened. Access database has not changed. Modifications are always
good in dataset, but not transmitted to Access Dababase.

And this time, I use a very little database with only one table with only
three fields : 1 autoincrement field, ans 2 text fields.
And there is one row (line) of data in table, writen directly in Access
(because I cannot do it in Visual Studio 2005).
I have created this database specially for resolving my problem, to be sure
that no relation troubled the process.

Curious thing :
One of the two text fields are declared as unique (both in Access database,
and dataset structure in vsstudio).
My table as only one line ans I try to add a new line. If I write a line
with the same value as the first for this unique field, I have the waited
message "Column ''Nom'' is constrained to be unique".
If I give ''false'' to the unique property of this field in Dataset Designer,
letting unique in Access table, I have the message of Access (in french,
it''s a french version of Access) : "Risque de doublons". Access detects the
unique problem. So he TRIES to write in database.

BUT IT''S IMPOSSIBLE TO WRITE A SECOND LINE IN TABLE from Visual Studio 2005,
EVEN IF I GIVE GOOD DATA (not unique) FOR THE SECOND LINE.
The Dataset creates line, takes data, but tableAdapter cannot write it in
database.

Do you see another reason for this impossibility to write in database ?

If someone of Microsoft can examine the problem, he is welcome. Because
today I don''t like Microsoft. -)

"Cor Ligthert [MVP]" <no************@planet.nl> a écrit dans le message de
news: e%****************@tk2msftngp13.phx.gbl...
菲利普,

没有多少人写问题。像你一样做。然而,这是一个国际新闻组,所以即使它不是正确的英语,我们也能理解很多。

你可能需要的只是endcurrentedit,它推动数据
在数据源中。

如果是数据源,可能使用强类型数据集。

BindingContext(StarDvdDataDataSet.artistes).EndCur rentEdit()

我希望这会有所帮助,


" philip" < pH值** @ philippe.com> schreef在bericht
新闻:43 *********************** @ news.wanadoo.fr ...
Philip,

There are not much people who write "probleme" as you do. However this is
an International newsgroup, so we understand a lot even if it is in not
correct English.

What you probably need is just the endcurrentedit, that pushes the data
down in the datasource.

Probably with your strongly typed dataset if that is the datasource.

BindingContext(StarDvdDataDataSet.artistes).EndCur rentEdit()

I hope this helps,

Cor
"philip" <ph**@philippe.com> schreef in bericht
news:43***********************@news.wanadoo.fr...
在表单上,​​我有一个datagridview。
这个datagridview是在tableadapter填充的数据集上构建的。
表适配器在填充数据集时做得非常好。
插入,修改
数据集中的删除和删除功能非常好。
但无法在ACCESS数据库中传输修改。无法在数据库中写入

这是从tableadapter到Access
数据库的数据传输代码:

Private Sub ArtistesBindingNavigatorSaveItem_Click(ByVal sender As
System.Object,ByVal e As System.EventArgs)处理
ArtistesBindingNavigatorSaveItem.Click
尝试
Me.Validate()
Me.ArtistesBindingSource.EndEdit()
Me.ArtistesTableAdapter.Update(Me.StarDvdDataDataS et.artistes)
System.Windows.Forms.MessageBox.Show(" Success!")
Catch ex As Exception
System。 Windows.Forms.MessageBox.Show(ex.Message)
结束尝试
结束子

程序说成功!但访问数据库没有任何改变。

可能是我很蠢,但我不明白!

请帮助我。
请原谅我英语。我是法国人。
On a form, I have a datagridview.
This datagridview is constructed on a dataset filled by a tableadapter.
The table adapter do very well what it must do when filling dataset.
Insertions, modifications and deletions functions very well in the
dataset.
But impossible to transmit modifications in ACCESS database. Impossible
to WRITE in database.

Here is the code for data transmission from tableadapter to Access
database :

Private Sub ArtistesBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ArtistesBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.ArtistesBindingSource.EndEdit()
Me.ArtistesTableAdapter.Update(Me.StarDvdDataDataS et.artistes)
System.Windows.Forms.MessageBox.Show("Success !")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub

Program says "Success !" but nothing has changed in access database.

May be I am stupid, but I don''t understand !

Please help me.
Excuse me for my english. I''m french.




Philip,


你试过吗?我写的也是什么?


Cor


" philip" < pH值** @ philippe.com> schreef in bericht

news:43 *********************** @ news.wanadoo.fr ...
Philip,

Did you try what I wrote as well?

Cor

"philip" <ph**@philippe.com> schreef in bericht
news:43***********************@news.wanadoo.fr...
感谢您的帮助

我添加了一行:Me.BindingContext(EssaiBindingSource).EndCurrentEd it()
尝试Me.EssaiBindingSource.EndEdit()
是不够的:

私有Sub EssaiBindingNavigatorSaveItem_Click(ByVal发送者为
System.Object,ByVal e As System.EventArgs)句柄
EssaiBindingNavigatorSaveItem.Click
尝试
Me.Validate()
Me.EssaiBindingSource.EndEdit()
Me.BindingContext(EssaiBindingSource).EndCurrentEd it()
Me.EssaiTableAdapter.Update(Me.Bd11DataSet.essai)
System.Windows.Forms.MessageBox.Show(" Success!")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
结束试试
结束子

什么都没发生。 Access数据库没有改变。修改总是在数据集中很好,但不会传输到Access Dababase。

这次,我使用的数据库很少,只有一个表只有三个字段:1自动增量字段,ans 2个文本字段。
表中有一行(行)数据,直接在Access中写入
(因为我无法在Visual Studio 2005中完成)。
我已经专门为解决我的问题创建了这个数据库,确保没有任何关系困扰这个过程。

好奇的事情:
两个文本字段之一被声明为唯一(在Access
数据库和vsstudio中的数据集结构中。
我的表只作为一行而我尝试添加新行。如果我写一行与此唯一字段的第一行具有相同的值,我会等待
消息列'Nom''被限制为唯一的
如果我在Dataset
Designer中给这个字段的独特属性''false'',让Access表中的唯一,我有Access的消息(在
法语中,它是Access的法语版本):Risque de doublons。访问
检测到唯一的问题。所以他试着在数据库中写作。

但是从Visual Studio中编写第二行是不可能的。
2005,即使我给了好的数据(不是唯一的)第二行。
数据集创建行,获取数据,但tableAdapter无法在数据库中写入。

您是否看到在数据库中无法写入的另一个原因?
Cor Ligthert [MVP]" <无************ @ planet.nl> écritdansle message de
新闻:e%**************** @ tk2msftngp13.phx.gbl ...
Thanks for uyour help

I added the line : Me.BindingContext(EssaiBindingSource).EndCurrentEd it()
to try if "Me.EssaiBindingSource.EndEdit()
" is not enough :

Private Sub EssaiBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
EssaiBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.EssaiBindingSource.EndEdit()
Me.BindingContext(EssaiBindingSource).EndCurrentEd it()
Me.EssaiTableAdapter.Update(Me.Bd11DataSet.essai)
System.Windows.Forms.MessageBox.Show("Success !")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub

Nothing happened. Access database has not changed. Modifications are
always good in dataset, but not transmitted to Access Dababase.

And this time, I use a very little database with only one table with only
three fields : 1 autoincrement field, ans 2 text fields.
And there is one row (line) of data in table, writen directly in Access
(because I cannot do it in Visual Studio 2005).
I have created this database specially for resolving my problem, to be
sure that no relation troubled the process.

Curious thing :
One of the two text fields are declared as unique (both in Access
database, and dataset structure in vsstudio).
My table as only one line ans I try to add a new line. If I write a line
with the same value as the first for this unique field, I have the waited
message "Column ''Nom'' is constrained to be unique".
If I give ''false'' to the unique property of this field in Dataset
Designer, letting unique in Access table, I have the message of Access (in
french, it''s a french version of Access) : "Risque de doublons". Access
detects the unique problem. So he TRIES to write in database.

BUT IT''S IMPOSSIBLE TO WRITE A SECOND LINE IN TABLE from Visual Studio
2005, EVEN IF I GIVE GOOD DATA (not unique) FOR THE SECOND LINE.
The Dataset creates line, takes data, but tableAdapter cannot write it in
database.

Do you see another reason for this impossibility to write in database ?

If someone of Microsoft can examine the problem, he is welcome. Because
today I don''t like Microsoft. -)

"Cor Ligthert [MVP]" <no************@planet.nl> a écrit dans le message de
news: e%****************@tk2msftngp13.phx.gbl...
Philip,

没有多少人写问题像你一样做。然而,这是一个国际新闻组,所以即使它不是正确的英语,我们也能理解很多。

你可能需要的只是endcurrentedit,它推动数据
在数据源中。

如果是数据源,可能使用强类型数据集。

BindingContext(StarDvdDataDataSet.artistes).EndCur rentEdit()

我希望这会有所帮助,


" philip" < pH值** @ philippe.com> schreef在bericht
新闻:43 *********************** @ news.wanadoo.fr ...
Philip,

There are not much people who write "probleme" as you do. However this is
an International newsgroup, so we understand a lot even if it is in not
correct English.

What you probably need is just the endcurrentedit, that pushes the data
down in the datasource.

Probably with your strongly typed dataset if that is the datasource.

BindingContext(StarDvdDataDataSet.artistes).EndCur rentEdit()

I hope this helps,

Cor
"philip" <ph**@philippe.com> schreef in bericht
news:43***********************@news.wanadoo.fr...
在表单上,​​我有一个datagridview。
这个datagridview是在tableadapter填充的数据集上构建的。
表适配器在填充数据集时做得非常好。
插入,修改
数据集中的删除和删除功能非常好。
但无法在ACCESS数据库中传输修改。无法在数据库中写入

这是从tableadapter到Access
数据库的数据传输代码:

Private Sub ArtistesBindingNavigatorSaveItem_Click(ByVal sender As
System.Object,ByVal e As System.EventArgs)处理
ArtistesBindingNavigatorSaveItem.Click
尝试
Me.Validate()
Me.ArtistesBindingSource.EndEdit()

Me.ArtistesTableAdapter.Update(Me.StarDvdDataDataS et.artistes)
System.Windows.Forms.MessageBox.Show(" Success!")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
结束尝试
结束子

程序说成功!但访问数据库没有任何改变。

可能是我很蠢,但我不明白!

请帮助我。
请原谅我英语。我是法国人。
On a form, I have a datagridview.
This datagridview is constructed on a dataset filled by a tableadapter.
The table adapter do very well what it must do when filling dataset.
Insertions, modifications and deletions functions very well in the
dataset.
But impossible to transmit modifications in ACCESS database. Impossible
to WRITE in database.

Here is the code for data transmission from tableadapter to Access
database :

Private Sub ArtistesBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ArtistesBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.ArtistesBindingSource.EndEdit()

Me.ArtistesTableAdapter.Update(Me.StarDvdDataDataS et.artistes)
System.Windows.Forms.MessageBox.Show("Success !")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub

Program says "Success !" but nothing has changed in access database.

May be I am stupid, but I don''t understand !

Please help me.
Excuse me for my english. I''m french.





这篇关于从tableadapter到ACCESS数据库的Problème数据传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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