By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,276 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,276 IT Pros & Developers. It's quick & easy.

Is this a bug?

P: n/a
Roy
Hi all,
I'm running a sql statement to delete records in a table in Access database.
If I run it inside the Access, it deletes with no problem, but when I call it
from vb.net(oledb), it doesn't delete any records and I don't get any errors.
Here's the code:
cmd.CommandText = DELETE FROM TABBLE WHERE FIELD1 LIKE 'A*'
cmd.ExecuteNonQuery()
Am I missing something here? Thanks for your input.
Roy
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Well if I'm not mistaken there is only one B in TABLE. :o)

Nick

"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
Hi all,
I'm running a sql statement to delete records in a table in Access
database.
If I run it inside the Access, it deletes with no problem, but when I call
it
from vb.net(oledb), it doesn't delete any records and I don't get any
errors.
Here's the code:
cmd.CommandText = DELETE FROM TABBLE WHERE FIELD1 LIKE 'A*'
cmd.ExecuteNonQuery()
Am I missing something here? Thanks for your input.
Roy

Nov 21 '05 #2

P: n/a
Hi Roy,

If I remember correctly, Access uses "*" and "?" as wilcards, while ODBC
drivers, OLEDB Provides, etc. uses ANSI "%" and "_" wildcards respectively.

So, try:

cmd.CommandText = DELETE FROM TABBLE WHERE FIELD1 LIKE 'A%'

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Roy" <Ro*@discussions.microsoft.com> escribió en el mensaje
news:06**********************************@microsof t.com...
Hi all,
I'm running a sql statement to delete records in a table in Access
database.
If I run it inside the Access, it deletes with no problem, but when I call
it
from vb.net(oledb), it doesn't delete any records and I don't get any
errors.
Here's the code:
cmd.CommandText = DELETE FROM TABBLE WHERE FIELD1 LIKE 'A*'
cmd.ExecuteNonQuery()
Am I missing something here? Thanks for your input.
Roy

Nov 21 '05 #3

P: n/a
Sorry Roy I was just being stupid.

Try replacing the * with % and see if that works.

Nick

"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
Hi all,
I'm running a sql statement to delete records in a table in Access
database.
If I run it inside the Access, it deletes with no problem, but when I call
it
from vb.net(oledb), it doesn't delete any records and I don't get any
errors.
Here's the code:
cmd.CommandText = DELETE FROM TABBLE WHERE FIELD1 LIKE 'A*'
cmd.ExecuteNonQuery()
Am I missing something here? Thanks for your input.
Roy

Nov 21 '05 #4

P: n/a
"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
If I run it inside the Access, it deletes with no problem, but when I
call it from vb.net(oledb), it doesn't delete any records and I don't
get any errors. DELETE FROM TABBLE WHERE FIELD1 LIKE 'A*'


You don't get an error because this statement is successfully deleting
zero rows. There aren't any rows in in TABBLE where FIELD1
contains the value "Ayy asterisk".
The wildcard character for OLEDB is "%", not "*". Try

DELETE FROM TABBLE WHERE FIELD1 LIKE 'A%'

instead.

HTH,
Phill W.
Nov 21 '05 #5

P: n/a
Roy
I just remembered after I saw your replies- that is a sign I'm getting old
for this
Thank you all,

"Phill. W" wrote:
"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
If I run it inside the Access, it deletes with no problem, but when I
call it from vb.net(oledb), it doesn't delete any records and I don't
get any errors.

DELETE FROM TABBLE WHERE FIELD1 LIKE 'A*'


You don't get an error because this statement is successfully deleting
zero rows. There aren't any rows in in TABBLE where FIELD1
contains the value "Ayy asterisk".
The wildcard character for OLEDB is "%", not "*". Try

DELETE FROM TABBLE WHERE FIELD1 LIKE 'A%'

instead.

HTH,
Phill W.

Nov 21 '05 #6

P: n/a
Try,

DELETE * FROM TABBLE WHERE FIELD1 LIKE 'A%'
"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com...
| I just remembered after I saw your replies- that is a sign I'm getting old
| for this
| Thank you all,
|
| "Phill. W" wrote:
|
| > "Roy" <Ro*@discussions.microsoft.com> wrote in message
| > news:06**********************************@microsof t.com...
| > > If I run it inside the Access, it deletes with no problem, but when I
| > > call it from vb.net(oledb), it doesn't delete any records and I don't
| > > get any errors.
| >
| > > DELETE FROM TABBLE WHERE FIELD1 LIKE 'A*'
| >
| > You don't get an error because this statement is successfully deleting
| > zero rows. There aren't any rows in in TABBLE where FIELD1
| > contains the value "Ayy asterisk".
| > The wildcard character for OLEDB is "%", not "*". Try
| >
| > DELETE FROM TABBLE WHERE FIELD1 LIKE 'A%'
| >
| > instead.
| >
| > HTH,
| > Phill W.
| >
| >
| >
Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.