I'm trying to update a Microsoft Access database. I can successfully
read from the database and submit a command to DELETE all records from
a table. Now I'm trying to add records to the table that I just
cleared. Below is the code:
myConnection = New
OleDb.OleDbConnection(accessConnectionStringConsta nt & accessMdb)
myCommand.Connection = myConnection
myCommand.CommandText = SqlString
myCommand.CommandType = CommandType.Text
myCommand.CommandTimeout = 420
myDataAdapter.SelectCommand = myCommand
Dim myCommandBuilder As New
OleDb.OleDbCommandBuilder(myDataAdapter)
myConnection.Open()
myDataAdapter.Update(dst.Tables(TableName))
This code is part of a Sub that receives the correct SELECT statement
in the "SqlString" parameter. After the
Dim myCommandBuilder As New
OleDb.OleDbCommandBuilder(myDataAdapter)
statement, the INSERT, UPDATE and DELETE statements are nothing in
myDataAdapter. So when the
myDataAdapter.Update(dst.Tables(TableName))
statement runs, an exception is thrown stating that the INSERT INTO
statement is invalid. What am I doing wrong? 7 1707
I should also say that my SELECT statements is this:
SELECT * FROM Users
I've seen other posts stating that it is possible there are columns
that are reservered words. So I encased each column withing square
brackets [], but I still got the same exception.
OK, I figured out why I am getting the problem.
My problem is that one of the columns is the word Password. Enclosing
it in square brackets like "[Password]" in the SELECT statement does
not fix the problem. I got around it in order to test this by not
including it. Unfortunately I cannot change the column name.
I'm reading from a SQL Server table and writing to an Access table.
I'm going to try and do this manually with my own INSERT statements.
Man...it feels like I'm only talking to myself. I hope that's not
bad : @
Anyway, I verified that is the problem. And I cannot change the
column name. It must remain "Password" for now. Does anyone know a
way around this?
Paul,
Can't you supply your own Insert, Update and Delete commands with [Password]?
Isn't it just that the commandbuilder doesn't handle this properly?
Kerry Moorman
"Paul" wrote:
Man...it feels like I'm only talking to myself. I hope that's not
bad : @
Anyway, I verified that is the problem. And I cannot change the
column name. It must remain "Password" for now. Does anyone know a
way around this?
Thanks for the response Kerry.
Yes, I can supply my own and am currently working on that. However, I
was just wondering if there was a parameter or some setting to tell
the CommandBuilder to resolve this, possibly by enclosing the fields
in square brackets.
I successfully INSERTed the records (abou 6,700 of them) using a
command object and an INSERT statement for each individual record (all
6,700). The performance sucks. If I run the code with the
CommandBuilder and DataAdapter, without the Password column, the whole
process takes 1 min 48 seconds. If I run the process with the
individual INSERT statements it takes 19 minutes.
Does anyone have any possible resolutions?
I've tried overwriting the INSERT statement in the myDataAdapter
object using [Password], but that didn't seem to work. I'll work on
that more and see if I can get it to work.
Ultimately, I would like the CommandBuilder to resolve this.
This explains why so few people use the CommandBuilder. ;-)
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
"Paul" <pw****@hotmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
>I successfully INSERTed the records (abou 6,700 of them) using a
command object and an INSERT statement for each individual record (all
6,700). The performance sucks. If I run the code with the
CommandBuilder and DataAdapter, without the Password column, the whole
process takes 1 min 48 seconds. If I run the process with the
individual INSERT statements it takes 19 minutes.
Does anyone have any possible resolutions?
I've tried overwriting the INSERT statement in the myDataAdapter
object using [Password], but that didn't seem to work. I'll work on
that more and see if I can get it to work.
Ultimately, I would like the CommandBuilder to resolve this. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dean Slindee |
last post by:
When launching another form from the current form, I use the code below to
determine if the form to be launched is already active and showing. If
form = Nothing, then I instantiate it, otherwise I...
|
by: johnb41 |
last post by:
I have a datagrid that successfully allows editing and updating (with
dataadapter.update command). I want the user to be able to edit the
"text" in the datagrid, but i DON'T want the user to be...
|
by: gregory_may |
last post by:
Is it possible to return "nothing" from an Integer function? This seems to
give me "0" rather than "nothing".
Private Function MyFunction() As Integer
Return Nothing
End Function
|
by: Josema |
last post by:
Hi to all,
Im getting an error that in theory is simple but i dont understand...
This is the line when i get the error, and the oledbcmd is well created,
with the connection opened, the...
|
by: abbylee26 |
last post by:
my page works fine if the db search finds at least one record that
satifies the query.
but if it does not find a match I get the following error message.
Error Type:
ADODB.Field (0x80020009)...
| |
by: MLH |
last post by:
I was wondering if setting object vars to Nothing near
the end of a sub procedure was beneficial at all - since
they (the OV's) are about to go out-a-scope anyway?
For example,
Sub MySub()...
|
by: triffid |
last post by:
Hi there,
I'm trying to update my database via an UPDATE from
OleDbCommandBuilder. This is the second time I've tried, and I'm still
not having any luck. I've almost certainly missed something...
|
by: =?Utf-8?B?QTdtYWQ=?= |
last post by:
Hi all,
I'm using OleDbCommandBuilder to build commands for an OleDbDataAdapter
automatically
The problem is when using OleDbDataAdapter to retrieve data from a "View" in
a SQL Express...
|
by: JB |
last post by:
Code is taken straight from a book but i can't get it working right.
Its generating an insert statement for inserting data into an excel
file.
//foreach (DataTable dt in ds.Tables)
//private...
|
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,...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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: 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...
|
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...
|
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...
| |
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 ...
| |