473,498 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nothing Generates for OleDbCommandBuilder

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?

Mar 15 '07 #1
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.

Mar 15 '07 #2
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.

Mar 15 '07 #3
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?

Mar 15 '07 #4
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?

Mar 15 '07 #5
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.

Mar 15 '07 #6
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.

Mar 15 '07 #7
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.

Mar 16 '07 #8

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

Similar topics

3
1425
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...
1
1917
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...
8
6052
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
2
4726
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...
25
2439
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)...
10
1662
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()...
2
1710
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...
0
951
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...
0
1922
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...
0
7125
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
7165
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
7205
jinu1996
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...
1
6887
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...
0
7379
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
4910
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
4590
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
3093
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
1419
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 ...

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.