asp.net和访问数据库锁定? [英] asp.net and access database locking?

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

问题描述




使用访问数据库时出现问题,我似乎在建立连接时创建了一个锁定的

文件。

我认为我已经涵盖了所有基础知识,比如正确关闭连接

等....

是否有任何在web.config中设置连接的probs可能会造成

这个问题?


我已经在下面提供了一个简化版本的代码。


在我的本地测试环境中,我可以重新启动IIS以移除锁定,我不能这样生活,因为我使用共享主机环境并且无法控制

框。

任何人都会遇到这样的事情吗?


提前致谢

amessimon


''########################################### >

''web.config中的连接字符串

Dim strConnection as string =

ConfigurationSettings.AppSettings(" ConnectionStrin g")

Dim strSQL as string = SQL statement ...............

Dim objConnection as new OledbConnection(strConnection)

Dim objCommand as new OledbCommand(strSQL,objConnection)

Dim objDataReader as OledbDataReader

objConnection.Open()

objDataReader = objCommand.ExecuteReader( )


执行时objDataReader.Read()= true

''等.................

循环


objDataReader.close()

objConnection.close()


''##########################################

Hi

Having problems using an access database where i seem to create a locked
file on making a connection.

I think ive covered all the basics like properly closing the connection
etc....
Are there any probs with setting connections in web.config that might create
this problem?

I''ve included a simplified version of the code in question below.

In my local test enviroment i can restart IIS to remove the lock, i cant do
this live as i use shared hosting evironment and have no control over the
box.
Anyone ever come across anything like this?

Thanks in advance
amessimon

''##########################################

''connection string in web.config
Dim strConnection as string =
ConfigurationSettings.AppSettings("ConnectionStrin g")
Dim strSQL as string = SQL statement...............
Dim objConnection as New OledbConnection(strConnection)
Dim objCommand as New OledbCommand(strSQL,objConnection)
Dim objDataReader as OledbDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()

Do While objDataReader.Read() = true
''etc.................
Loop

objDataReader.close()
objConnection.close()

''##########################################

推荐答案

我遇到了这个..在我的情况下,这是因为Access数据库是另一个网络使用的
用户直接从Access。


-Brian


" amessimon" <是******************* @ hotmail.com>在消息中写道

news:uM ************* @ TK2MSFTNGP09.phx.gbl ...
I have run across this.. In my case it was because the Access database was
being used by another network user directly from Access.

-Brian

"amessimon" <am*******************@hotmail.com> wrote in message
news:uM*************@TK2MSFTNGP09.phx.gbl...


使用访问数据库时出现问题,我似乎在建立连接时创建一个锁定的文件。

我认为我已经涵盖了所有基础知识,如正确关闭连接
等等....
在web.config中有没有设置连接的probs可能会产生这个问题?

我已经包含了一个简化版本的代码问题如下。

在我的本地测试环境中,我可以重新启动IIS来删除锁定,我不能通过
这样做,因为我使用共享主机环境并且无法控制
任何人都会遇到这样的事情吗?

提前致谢
amessimon

''########## ################################
'''web.config中的连接字符串
ConfigurationSettings.AppSettings(" ConnectionStrin g&qu ot;)
Dim strSQL as string = SQL statement ...............
Dim objConnection as new OledbConnection(strConnection)
Dim objCommand as new OledbCommand (strSQL,objConnection)
Dim objDataReader as OledbDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()

做objDataReader.Read()= true
''等.................
循环

objDataReader.close()
objConnection.close( )

''############################################################################## ###

Hi

Having problems using an access database where i seem to create a locked
file on making a connection.

I think ive covered all the basics like properly closing the connection
etc....
Are there any probs with setting connections in web.config that might create this problem?

I''ve included a simplified version of the code in question below.

In my local test enviroment i can restart IIS to remove the lock, i cant do this live as i use shared hosting evironment and have no control over the
box.
Anyone ever come across anything like this?

Thanks in advance
amessimon

''##########################################

''connection string in web.config
Dim strConnection as string =
ConfigurationSettings.AppSettings("ConnectionStrin g")
Dim strSQL as string = SQL statement...............
Dim objConnection as New OledbConnection(strConnection)
Dim objCommand as New OledbCommand(strSQL,objConnection)
Dim objDataReader as OledbDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()

Do While objDataReader.Read() = true
''etc.................
Loop

objDataReader.close()
objConnection.close()

''##########################################



我认为您需要添加Mode = 16。你的连接字符串。


" amessimon" <是******************* @ hotmail.com>在消息中写道

news:uM ************* @ TK2MSFTNGP09.phx.gbl ...
I think you need to add "Mode=16" to your connection string.

"amessimon" <am*******************@hotmail.com> wrote in message
news:uM*************@TK2MSFTNGP09.phx.gbl...


使用访问数据库时出现问题,我似乎在建立连接时创建一个锁定的文件。

我认为我已经涵盖了所有基础知识,如正确关闭连接
等....
在web.config中是否有任何设置连接的probs可能会产生这个问题?

我已经包含了简化版本下面讨论的代码。

在我的本地测试环境中,我可以重新启动IIS以删除锁定,我不能这样做,因为我使用共享主机环境并且有无法控制
盒子。
任何人都遇到过这样的事情吗?

提前致谢
amessimon

''## ########################################

'' web.config中的连接字符串
Dim strConnection as string =
ConfigurationSettings.AppSettings(&Connect)将strim作为字符串= SQL语句...............
将dim objConnection改为新的OledbConnection(strConnection)
将objCommand作为新的OledbCommand(strSQL,objConnection)
Dim objDataReader as OledbDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()

执行时objDataReader.Read()= true
''等.................
循环

objDataReader.close()
objConnection.close ()

''####################################### ####

Hi

Having problems using an access database where i seem to create a locked
file on making a connection.

I think ive covered all the basics like properly closing the connection
etc....
Are there any probs with setting connections in web.config that might
create
this problem?

I''ve included a simplified version of the code in question below.

In my local test enviroment i can restart IIS to remove the lock, i cant
do
this live as i use shared hosting evironment and have no control over the
box.
Anyone ever come across anything like this?

Thanks in advance
amessimon

''##########################################

''connection string in web.config
Dim strConnection as string =
ConfigurationSettings.AppSettings("ConnectionStrin g")
Dim strSQL as string = SQL statement...............
Dim objConnection as New OledbConnection(strConnection)
Dim objCommand as New OledbCommand(strSQL,objConnection)
Dim objDataReader as OledbDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()

Do While objDataReader.Read() = true
''etc.................
Loop

objDataReader.close()
objConnection.close()

''##########################################



可能是一个愚蠢的问题....但这很难测试,因为我必须

复制并重命名数据库或每次测试时重新启动IIS

这个...所以我会问它。


这是另一个节点还是属性。我在哪里添加这个?

此模式设置完全正确,我无法在线查找

参考。


提前致谢


" Steven" < MS ****** @ berkovitz.org>在留言中写道

新闻:uC ************** @ TK2MSFTNGP12.phx.gbl ...
Probably a stupid question....but this is difficult to test as i have to
either copy and rename the database or restart IIS everytime i test
this...so i''ll ask it.

Is this another node or an attribute. Where do i add this?
Also what does this mode setting do exactly, i''m having trouble finding
references online.

Thanks in advance

"Steven" <ms******@berkovitz.org> wrote in message
news:uC**************@TK2MSFTNGP12.phx.gbl...
我认为你需要添加Mode = 16你的连接字符串。

amessimon <是******************* @ hotmail.com>在消息中写道
新闻:uM ************* @ TK2MSFTNGP09.phx.gbl ...
I think you need to add "Mode=16" to your connection string.

"amessimon" <am*******************@hotmail.com> wrote in message
news:uM*************@TK2MSFTNGP09.phx.gbl...


使用访问数据库的问题,我似乎在建立连接时创建一个锁定的
文件。

我认为我已经涵盖了所有基础知识,如正确关闭连接等等...... 。
是否有任何在web.config中设置连接的probs可能会产生这个问题?

我已经包含了一个简化版本的代码下面的问题。

在我的本地测试环境中,我可以重新启动IIS以移除锁定,我不能这样做,因为我使用共享主机环境并且无法控制
盒子。
任何人都会遇到这样的事情吗?

提前致谢
amessimon

''###### ####################################

''中的连接字符串.config
Dim strConnection as string =
ConfigurationSettings.AppSettings(" ConnectionStr在g")
Dim strSQL as string = SQL statement ...............
Dim objConnection as new OledbConnection(strConnection)
Dim objCommand as New OledbCommand(strSQL,objConnection)
Dim objDataReader as OledbDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()

执行时objDataReader.Read()= true
''等.................
循环

objDataReader.close()
objConnection.close ()

''####################################### ####

Hi

Having problems using an access database where i seem to create a locked
file on making a connection.

I think ive covered all the basics like properly closing the connection
etc....
Are there any probs with setting connections in web.config that might
create
this problem?

I''ve included a simplified version of the code in question below.

In my local test enviroment i can restart IIS to remove the lock, i cant
do
this live as i use shared hosting evironment and have no control over the box.
Anyone ever come across anything like this?

Thanks in advance
amessimon

''##########################################

''connection string in web.config
Dim strConnection as string =
ConfigurationSettings.AppSettings("ConnectionStrin g")
Dim strSQL as string = SQL statement...............
Dim objConnection as New OledbConnection(strConnection)
Dim objCommand as New OledbCommand(strSQL,objConnection)
Dim objDataReader as OledbDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()

Do While objDataReader.Read() = true
''etc.................
Loop

objDataReader.close()
objConnection.close()

''##########################################




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

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