vb.net和访问 [英] vb.net and access

查看:66
本文介绍了vb.net和访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候所有


我有一个表格,可以读取访问备忘录字段。我可以查询数据库

获取备忘录字段中的信息没有问题...但是当我尝试更新

数据时我得到一个例外。备忘录字段中的文本可能很大。只有在更新了大量数据时才会抛出异常。
seens抛出异常。以下是更新代码:rtNotes是一个richtext文本框..

任何帮助将不胜感激

Dim mNotes As String = rtNotes.Text& String.Empty''''


sqlStatement =" update master set Cust_Notes =''" &安培; mNotes& " ''其中

str(trim(MasterId))=" &安培; _


"''" &安培;修剪(glbLookup)& " ''"


SetUpDataBase()


尝试


cmd.ExecuteNonQuery()


赶上Ex Exception


MsgBox(Ex.ToString)


结束尝试


btnSave.Enabled = False


使用Label6


..Text =" Locked"


..ForeColor = Color.Black


结束

解决方案

< blockquote>嗨Stephen,


一些想法:尝试使用字符串更新ms访问中的列

与失败的字符串相同。另外,尝试通过vb .net

本身保存数据,而不是使用更新的sql语句 - 一个不应该工作

比另一个好,但我是好奇,如果那样可行。


最后,发布异常并发布应该更新的确切文本

异常发生时的备注字段。我可以在我的

系统上进行测试,看看我的体验。


HTH,


Bernie Yaeger


" Stephen" <圣****** @ xjohnstontrading.com>在消息中写道

新闻:O6 ************** @ TK2MSFTNGP11.phx.gbl ...

所有问候
我有一个表单,可以读取访问备忘录字段。我可以查询数据库以获取备忘录字段中的信息而没有问题...但是当我尝试更新数据时,我得到了一个例外。备忘录字段中的文本可能很大。只有在更新大量数据时才会抛出异常。以下是更新代码:rtNotes是一个富文本
文本框..
任何帮助将不胜感激
Dim mNotes As String = rtNotes.Text& String.Empty''''

sqlStatement =" update master set Cust_Notes =''" &安培; mNotes& " ''
str(trim(MasterId))=" &安培; _

"''" &安培;修剪(glbLookup)& " ''"

SetUpDataBase()

尝试

cmd.ExecuteNonQuery()

抓住Ex作为例外

MsgBox(Ex.ToString)

结束尝试

btnSave.Enabled = False

使用Label6

.Text =" Locked"

.ForeColor = Color.Black

结束



嗨Stephen,


一些想法:尝试使用字符串更新ms访问中的列

与大小相同一个失败了。另外,尝试通过vb .net

本身保存数据,而不是使用更新的sql语句 - 一个不应该工作

比另一个好,但我是好奇,如果那样可行。


最后,发布异常并发布应该更新的确切文本

异常发生时的备注字段。我可以在我的

系统上进行测试,看看我的体验。


HTH,


Bernie Yaeger


" Stephen" <圣****** @ xjohnstontrading.com>在消息中写道

新闻:O6 ************** @ TK2MSFTNGP11.phx.gbl ...

所有问候
我有一个表单,可以读取访问备忘录字段。我可以查询数据库以获取备忘录字段中的信息而没有问题...但是当我尝试更新数据时,我得到了一个例外。备忘录字段中的文本可能很大。只有在更新大量数据时才会抛出异常。以下是更新代码:rtNotes是一个富文本
文本框..
任何帮助将不胜感激
Dim mNotes As String = rtNotes.Text& String.Empty''''

sqlStatement =" update master set Cust_Notes =''" &安培; mNotes& " ''
str(trim(MasterId))=" &安培; _

"''" &安培;修剪(glbLookup)& " ''"

SetUpDataBase()

尝试

cmd.ExecuteNonQuery()

抓住Ex作为例外

MsgBox(Ex.ToString)

结束尝试

btnSave.Enabled = False

使用Label6

.Text =" Locked"

.ForeColor = Color.Black

结束



嗨Bernie


在我的头撞到桌子后,我注意到我唯一一次获得

的例外情况是文字中的萎缩就像(没有)......必须要有一个方法来支付它的价值


" Bernie Yaeger" <是***** @ cherwellinc.com>在消息中写道

news:e2 ************** @ tk2msftngp13.phx.gbl ...

嗨Stephen, ..net本身保存数据,而不是使用更新的sql语句 - 一个不应该比另一个更好地工作,但我很好奇是否可行。

最后,发布异常并发布应该具有
的确切文本,以便在发生异常时更新备注字段。然后我可以在我的
系统上测试它,看看我的经历。

HTH,

Bernie Yaeger

Stephen <圣****** @ xjohnstontrading.com>在消息中写道
新闻:O6 ************** @ TK2MSFTNGP11.phx.gbl ...

所有人的问候
我有一个读取访问备忘录字段的表单。我可以查询数据库
来获取备忘录字段中的信息而没有问题......但是当我尝试更新
数据时我得到了一个例外。备忘录字段中的文本可能很大。只有在更新大量数据时才会抛出异常。以下是更新代码:rtNotes是一个富文本
文本框..
任何帮助将不胜感激
Dim mNotes As String = rtNotes.Text& String.Empty''''

sqlStatement =" update master set Cust_Notes =''" &安培; mNotes& " ''
str(trim(MasterId))=" &安培; _

"''" &安培;修剪(glbLookup)& " ''"

SetUpDataBase()

尝试

cmd.ExecuteNonQuery()

抓住Ex作为例外

MsgBox(Ex.ToString)

结束尝试

btnSave.Enabled = False

使用Label6

.Text =" Locked"

.ForeColor = Color.Black

结束




Greetings all

I have a form that reads a access memo field. I can query the database to
get the info in the memo field without a problem...but when i try to update
the data i get a exception. The text in the memo field can be large. It
seens to throw the exception only when large amounts of data is being
updated. The following is the update code : rtNotes is a richtext textbox..
any help will be appreciated
Dim mNotes As String = rtNotes.Text & String.Empty ''''

sqlStatement = "update master set Cust_Notes = '' " & mNotes & " '' where
str(trim(MasterId)) = " & _

"'' " & Trim(glbLookup) & " ''"

SetUpDataBase()

Try

cmd.ExecuteNonQuery()

Catch Ex As Exception

MsgBox(Ex.ToString)

End Try

btnSave.Enabled = False

With Label6

..Text = "Locked"

..ForeColor = Color.Black

End With

解决方案

Hi Stephen,

A couple of ideas: try updating the column inside ms access with a string
the same size as one that fails. Also, try saving the data through vb .net
itself, instead of using an update sql statement - one should not work
better than the other, but I''m curious if that would work.

Finally, post the exception and post the exact text that should have updated
the memo field when the exception occurred. I could then test it on my
system to see what I experience.

HTH,

Bernie Yaeger

"Stephen" <St******@xjohnstontrading.com> wrote in message
news:O6**************@TK2MSFTNGP11.phx.gbl...

Greetings all

I have a form that reads a access memo field. I can query the database to
get the info in the memo field without a problem...but when i try to
update
the data i get a exception. The text in the memo field can be large. It
seens to throw the exception only when large amounts of data is being
updated. The following is the update code : rtNotes is a richtext
textbox..
any help will be appreciated
Dim mNotes As String = rtNotes.Text & String.Empty ''''

sqlStatement = "update master set Cust_Notes = '' " & mNotes & " '' where
str(trim(MasterId)) = " & _

"'' " & Trim(glbLookup) & " ''"

SetUpDataBase()

Try

cmd.ExecuteNonQuery()

Catch Ex As Exception

MsgBox(Ex.ToString)

End Try

btnSave.Enabled = False

With Label6

.Text = "Locked"

.ForeColor = Color.Black

End With



Hi Stephen,

A couple of ideas: try updating the column inside ms access with a string
the same size as one that fails. Also, try saving the data through vb .net
itself, instead of using an update sql statement - one should not work
better than the other, but I''m curious if that would work.

Finally, post the exception and post the exact text that should have updated
the memo field when the exception occurred. I could then test it on my
system to see what I experience.

HTH,

Bernie Yaeger

"Stephen" <St******@xjohnstontrading.com> wrote in message
news:O6**************@TK2MSFTNGP11.phx.gbl...

Greetings all

I have a form that reads a access memo field. I can query the database to
get the info in the memo field without a problem...but when i try to
update
the data i get a exception. The text in the memo field can be large. It
seens to throw the exception only when large amounts of data is being
updated. The following is the update code : rtNotes is a richtext
textbox..
any help will be appreciated
Dim mNotes As String = rtNotes.Text & String.Empty ''''

sqlStatement = "update master set Cust_Notes = '' " & mNotes & " '' where
str(trim(MasterId)) = " & _

"'' " & Trim(glbLookup) & " ''"

SetUpDataBase()

Try

cmd.ExecuteNonQuery()

Catch Ex As Exception

MsgBox(Ex.ToString)

End Try

btnSave.Enabled = False

With Label6

.Text = "Locked"

.ForeColor = Color.Black

End With



Hi Bernie

After slamming my head against the desk, i noticed the only time i get a
exception is when a apostrophy is in the text like (didn''t) ... there has to
be a way around it

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:e2**************@tk2msftngp13.phx.gbl...

Hi Stephen,

A couple of ideas: try updating the column inside ms access with a string
the same size as one that fails. Also, try saving the data through vb ..net itself, instead of using an update sql statement - one should not work
better than the other, but I''m curious if that would work.

Finally, post the exception and post the exact text that should have updated the memo field when the exception occurred. I could then test it on my
system to see what I experience.

HTH,

Bernie Yaeger

"Stephen" <St******@xjohnstontrading.com> wrote in message
news:O6**************@TK2MSFTNGP11.phx.gbl...

Greetings all

I have a form that reads a access memo field. I can query the database to get the info in the memo field without a problem...but when i try to
update
the data i get a exception. The text in the memo field can be large. It
seens to throw the exception only when large amounts of data is being
updated. The following is the update code : rtNotes is a richtext
textbox..
any help will be appreciated
Dim mNotes As String = rtNotes.Text & String.Empty ''''

sqlStatement = "update master set Cust_Notes = '' " & mNotes & " '' where
str(trim(MasterId)) = " & _

"'' " & Trim(glbLookup) & " ''"

SetUpDataBase()

Try

cmd.ExecuteNonQuery()

Catch Ex As Exception

MsgBox(Ex.ToString)

End Try

btnSave.Enabled = False

With Label6

.Text = "Locked"

.ForeColor = Color.Black

End With




这篇关于vb.net和访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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