OK, I got something REALLY simple-sounding that is turning in to something
REALLY frickin hard. All I need to do is suck the data out of one Access
database and stuff it in another one. Here's my current code:
Sub main()
'First download the database from the web server
Dim ftp As New FTPFunctions.FTPClassClass
ftp.FTPDownload("remotename.mdb", "localname.mdb", "www.someserver.com",
"username", "passwordtext")
'Then query it for the Broker records and stuff them in a dataset (table
name: AgentDB)
Dim da As New OleDb.OleDbDataAdapter("Select * from UserDB where
HomeURL='broker_info.asp'", "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=c:\temp\weluser.mdb;")
Dim ds As New DataSet
da.Fill(ds.Tables.Add("AgentDB"))
'Now, clear the existing in-house database
Dim conn As New OleDb.OleDbConnection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=h:\app_Data\access\BrokerEmail.mdb; Mode=ReadWrite;"
Dim cmd As New OleDb.OleDbCommand("Delete from Broker", conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
'Now that the existing database is clear, modify the query results to match
the in-house DB's schema
ds.Tables("AgentDB").Columns.Remove("Pass")
ds.Tables("AgentDB").Columns.Remove("PWExpire")
ds.Tables("AgentDB").Columns.Remove("HomeURL")
ds.Tables("AgentDB").Columns.Remove("LastLogin")
'Take the results of the query and stuff them in the in-house database.
Dim da2 As New OleDb.OleDbDataAdapter("Select * from Broker",
conn.ConnectionString)
Dim cb As New OleDb.OleDbCommandBuilder(da2)
da2.UpdateCommand = cb.GetUpdateCommand
da2.Update(ds, "AgentDB")
End Sub
It executes with no errors but does not update the table. I have tried
making a copy of the DataSet (ds) to use in the update but with no success. 2 1424
* "Rick Palmer" <ri*********@welove.com.nospam> scripsit: OK, I got something REALLY simple-sounding that is turning in to something REALLY frickin hard. All I need to do is suck the data out of one Access database and stuff it in another one. Here's my current code:
ADO.NET group:
<news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>
Web interface:
<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.adonet>
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Hi Rick,
It appears as if you are deleting broker and then selecting all from it - it
you deleted all of the rows, it returns zero rows. Am I missing something
here?
HTH,
Bernie Yaeger
"Rick Palmer" <ri*********@welove.com.nospam> wrote in message
news:O3*************@tk2msftngp13.phx.gbl... OK, I got something REALLY simple-sounding that is turning in to something REALLY frickin hard. All I need to do is suck the data out of one Access database and stuff it in another one. Here's my current code:
Sub main() 'First download the database from the web server Dim ftp As New FTPFunctions.FTPClassClass ftp.FTPDownload("remotename.mdb", "localname.mdb", "www.someserver.com", "username", "passwordtext")
'Then query it for the Broker records and stuff them in a dataset (table name: AgentDB) Dim da As New OleDb.OleDbDataAdapter("Select * from UserDB where HomeURL='broker_info.asp'", "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\temp\weluser.mdb;") Dim ds As New DataSet da.Fill(ds.Tables.Add("AgentDB"))
'Now, clear the existing in-house database Dim conn As New OleDb.OleDbConnection conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=h:\app_Data\access\BrokerEmail.mdb; Mode=ReadWrite;" Dim cmd As New OleDb.OleDbCommand("Delete from Broker", conn) conn.Open() cmd.ExecuteNonQuery() conn.Close()
'Now that the existing database is clear, modify the query results to
match the in-house DB's schema ds.Tables("AgentDB").Columns.Remove("Pass") ds.Tables("AgentDB").Columns.Remove("PWExpire") ds.Tables("AgentDB").Columns.Remove("HomeURL") ds.Tables("AgentDB").Columns.Remove("LastLogin")
'Take the results of the query and stuff them in the in-house database. Dim da2 As New OleDb.OleDbDataAdapter("Select * from Broker", conn.ConnectionString) Dim cb As New OleDb.OleDbCommandBuilder(da2) da2.UpdateCommand = cb.GetUpdateCommand da2.Update(ds, "AgentDB") End Sub
It executes with no errors but does not update the table. I have tried making a copy of the DataSet (ds) to use in the update but with no
success. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jani Tamminen |
last post by:
I want to copy data from our production database to the development
database. I want to move only the data. I do not need the table structure,
constrains or anything else.
I think I can use the...
|
by: radioman |
last post by:
Hi all, I would appreciate some help please.
I just need pointing in the right direction as I am at a loss.
Basically I have a form (frmAddMaster) which displays two subforms
"Master Stock...
|
by: Tom van Stiphout |
last post by:
I have written some code to export all objects to text files, and to
import those files back into a new database. Hopefully this will
eliminate some forms of corruption.
The icing on the cake...
|
by: Nedu N |
last post by:
Hi Techies,
I am facing problem in copying content of table from a untyped dataset into
to a table inside the typed dataset. I wanted to copy the data into typed
dataset in order to ease the...
|
by: zMisc |
last post by:
Is it possible to copy a table from one schema to another schema by just
copying the frm file to the directory for the new schema?
What is the best way to create a new database with all the...
|
by: aoao |
last post by:
I need to make a new database at the beginning of every year but have forgotten how to do this quickly and efficiently.
I have a database with about 10 tables, 10 forms related to the 10 tables...
|
by: RS200Phil |
last post by:
Hi all,
We have this morning used DTS to copy some objects from one database
to another.
We removed the tick to "Copy all objects" and selected just the 4
tables that we wanted
However, we...
|
by: troy_lee |
last post by:
What is the best way of copying all the records from a linked table
into a replica table that is local on my computer? This is for
development work at home where I can not access the main table. Is...
|
by: tshad |
last post by:
Running on VS.net 2005,
I am trying to copy rows from my datatable to another datatable in the same
dataset.
The schema would be identical.
I need to make the table name "forms" as I am...
|
by: ElishaThompson |
last post by:
I recently had a problem requiring me to locate and copy all records pertaining to a particular client from numerous tables in a database on a given server to tables within an identical database on...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |