473,503 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

update dbase file with function

JFB
Hi,
I have a connection to a dbase IV file using oledb. I wan to do an update to
a field using a vb function passing two parameters. These 2 parameters are
fields from the same table.
What is the sintax to do this?
Thanks

JFB

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
filePath & ";Extended Properties=dBase IV"

Dim dBaseConnection As New
System.Data.OleDb.OleDbConnection(ConnectionString )

Try

dBaseConnection.Open()

Dim dBaseCommand As New System.Data.OleDb.OleDbCommand("update " & dbfFile &
" set Column4 = FSB(Column1, Column2)", dBaseConnection)

dBaseCommand.ExecuteNonQuery()

Catch ex As Exception

MsgBox(ex.ToString)

Finally

dBaseConnection.Close()

End Try

Function FSB(ByVal inTrack As String, ByVal inRoute As String) As String

bla...bla....

End Function

Jan 18 '08 #1
1 3928
JFB
Got it... FYI

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
filePath & ";Extended Properties=dBase IV"

Dim dBaseConnection As New
System.Data.OleDb.OleDbConnection(ConnectionString )

Try

dBaseConnection.Open()

Dim dBaseCommand As New System.Data.OleDb.OleDbCommand("select * from " &
dbfFile, dBaseConnection)

Dim dBaseDataReader As System.Data.OleDb.OleDbDataReader =
dBaseCommand.ExecuteReader(CommandBehavior.Sequent ialAccess)

While dBaseDataReader.Read

Dim parameter1 As String = dBaseDataReader("Colum2").ToString

Dim parameter2 As String = dBaseDataReader("Colum3").ToString

Dim updateCommand As New System.Data.OleDb.OleDbCommand("update " & dbfFile
& " set Column4 = '" & FSB(parameter1, parameter2) & "' where Column2 = '" &
parameter1 & "' and Column3 = '" & parameter2 & "'", dBaseConnection)

updateCommand.ExecuteNonQuery()

End While

Catch ex As Exception

MsgBox(ex.ToString)

Finally

dBaseConnection.Close()

End Try

"JFB" <jf*@help.comwrote in message
news:eB****************@TK2MSFTNGP04.phx.gbl...
Hi,
I have a connection to a dbase IV file using oledb. I wan to do an update
to
a field using a vb function passing two parameters. These 2 parameters are
fields from the same table.
What is the sintax to do this?
Thanks

JFB

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
filePath & ";Extended Properties=dBase IV"

Dim dBaseConnection As New
System.Data.OleDb.OleDbConnection(ConnectionString )

Try

dBaseConnection.Open()

Dim dBaseCommand As New System.Data.OleDb.OleDbCommand("update " & dbfFile
&
" set Column4 = FSB(Column1, Column2)", dBaseConnection)

dBaseCommand.ExecuteNonQuery()

Catch ex As Exception

MsgBox(ex.ToString)

Finally

dBaseConnection.Close()

End Try

Function FSB(ByVal inTrack As String, ByVal inRoute As String) As String

bla...bla....

End Function



Jan 18 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
7883
by: level8 | last post by:
I would like to see a Clipper/dbase DBF file as a table in SQL Server 7.0. How can I SELECT rows from DBF file? Should I use OLE DB Provider or ODBC, and how?
1
5239
by: Derek Griffiths | last post by:
Most of the complicated programs I write are boring applications that manipulate databases associated with the medical billing program where I work. The program uses foxpro dbases (version 3) for...
3
5473
by: Frank | last post by:
Hi, the problem I have is that an older dos program is using dbase 3 or 4 database files and I wish to add a little utility that scanns this database, and if specific record has a certain entry...
0
1167
by: yefei | last post by:
Now I am doing in asp.net 2.0 using Visual Web Developer 2005 express edition I have set up a connction to a dBase IV file .dbf using ODBCconnection but by default I can only read the data(i.e....
2
1831
by: chiefsitebuilder | last post by:
I have a question about saving an MS Access program to CD and verifyng that the program works after being saved. Here is my situation, I have a person who developed an application for me using...
0
1548
by: j.np.12 | last post by:
I have an Access XP database which links to dBase III format tables and updates them. The app used to work fine until recently when the dBase index tables keep getting corrupted and need to be...
4
4815
by: Robert Bravery | last post by:
HI all, Can someone show me or point me to a place where I can find out how to update dbase(dbf) tables. Thanks RObert
6
3781
by: Aleyna[] | last post by:
Hi all, I wanted to connect an old DBASE file (I don't know the exact version) but I could not make it at all. I couldn't find a way to execute sql statements on db file using c#. The...
2
11119
by: bcbrock | last post by:
I am trying to figure out how to query some data out of a dbase IV (.dbf) file sitting on a remote server from my MySQL/PHP/Web Server. Both servers are Windows Server 2003 SP2. My...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.