Ado.Net OLEDB timeout?

N

nick

I am using ADO.Net with OLEDB Jet driver to access dbase (dbf) files on the
mapped Netware drive. The program just halt there is a problem of the mapped
drive or files (for example, wrong path to the file is given).

Any way to control the timeout of the connection? For example abort if 20
seconds passed.
 
V

Val Mazur

Hi,

OledbConnection class has property that calls ConnectionTimeout. You could
set it to desired value
 
V

Val Mazur

Sounds strange. Could you post part of code, which opens connection? Which
version of VS.NET are you using?
 
N

nick

The VS.Net version is 2003. The code to write is quite simple:

Dim InsertCmdStr As String = "Insert Into wolog (WOTYPE, REF_NO, PRIORITY,
Unit, DEPT, DEPT_ID, PAC2, RQNAME, RQPHONE, SHOP, ASTO, WODATE, WOTIME,
OPTR, LOCATION, COMM1, ESTHR, STATUS, UP, ROOM, FLR, JULIAN, WOSQN) values
('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}',#{11}#,'{12}','{13}','{14}','{15}',{16},'{17}','{18}','{19}','{20}','{21}','{22}')"

InsertCmdStr = String.Format(InsertCmdStr, WOTYPE, REF_NO, PRIORITY, Unit,
DEPT, DEPT_ID, PAC2, RQNAME, RQPHONE, SHOP, ASTO, WODATE,
WODATE.ToString("hh:mm"), OPTR, LOCATION, COMM1, ESTHR, STATUS, UP, ROOM,
FLR, Mid(REF_NO, 2, 3), Mid(REF_NO, 5, 3))

Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=\\192.168.0.1\NetWare\Shared\Energy\CAMMS\temp;Extended
Properties=dBase IV;")

Dim cmd As New OleDbCommand(InsertCmdStr, conn)

Try

conn.Open()

cmd.ExecuteNonQuery()

Catch e As Exception

Throw e

Finally

If Not cmd.Connection Is Nothing Then

cmd.Connection.Close()

End If

End Try
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top