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

Parameter it doesn't work (for me) II

P: n/a
Fia
Hi again
I tried the code below and know the CommandText looks like it should from
the Trace,
but I still don't get any records.
When I'm running the SQL statement in the Access database I get records.

sökaOrdCom = New OleDbCommand("Select * from kött where köttid Like " & "'"
& PubStr & "*'", DBConn)
sökaOrdRead = sökaOrdCom.ExecuteReader
Trace.WriteLine(sökaOrdCom.CommandText)

Do While sökaOrdRead.Read
recCount += 1 'this code never happens
Loop

I don't get this, please help me.

Fia
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
No problem just to keep it in one thread
Nov 21 '05 #2

P: n/a
As you were told last time you posted this question, the wildcard for like
in ADO and ADO.NET is %, not *.
"Fia" <fi*****@telia.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi again
I tried the code below and know the CommandText looks like it should from
the Trace,
but I still don't get any records.
When I'm running the SQL statement in the Access database I get records.

sökaOrdCom = New OleDbCommand("Select * from kött where köttid Like " &
"'"
& PubStr & "*'", DBConn)
sökaOrdRead = sökaOrdCom.ExecuteReader
Trace.WriteLine(sökaOrdCom.CommandText)

Do While sökaOrdRead.Read
recCount += 1 'this code never happens
Loop

I don't get this, please help me.

Fia

Nov 21 '05 #3

P: n/a
> As you were told last time you posted this question, the wildcard for like
in ADO and ADO.NET is %, not *.

What has AdoNet to do with a select string?

http://msdn.microsoft.com/library/de.../acfundsql.asp

Thanks for posting in this thread while there is an earlier one with the
same message by the way.

Cor
Nov 21 '05 #4

P: n/a
From the page you indicated:

<quote>
Note The % and _ (underscore) wildcard characters should be used only
through the Jet OLE DB provider and ActiveX® Data Objects (ADO) code. They
will be treated as literal characters if they are used though the Access SQL
View user interface or Data Access Objects (DAO) code.
</quote>

There is a very good reason for this and that is because ADO (both flavours)
specifies % and _ as the wildcard characters in SQL statements. * and ? just
don't work. Whatever the rights, wrongs or indifferences, it is a fact of
life.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
As you were told last time you posted this question, the wildcard for
like in ADO and ADO.NET is %, not *.

What has AdoNet to do with a select string?

http://msdn.microsoft.com/library/de.../acfundsql.asp

Thanks for posting in this thread while there is an earlier one with the
same message by the way.

Cor

Nov 21 '05 #5

P: n/a
Fia
Thank's now it works!!!

Fia
"Stephany Young" <noone@localhost> skrev i meddelandet
news:%2******************@TK2MSFTNGP14.phx.gbl...
From the page you indicated:

<quote>
Note The % and _ (underscore) wildcard characters should be used only
through the Jet OLE DB provider and ActiveX® Data Objects (ADO) code. They
will be treated as literal characters if they are used though the Access SQL View user interface or Data Access Objects (DAO) code.
</quote>

There is a very good reason for this and that is because ADO (both flavours) specifies % and _ as the wildcard characters in SQL statements. * and ? just don't work. Whatever the rights, wrongs or indifferences, it is a fact of
life.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
As you were told last time you posted this question, the wildcard for
like in ADO and ADO.NET is %, not *.

What has AdoNet to do with a select string?

http://msdn.microsoft.com/library/de.../acfundsql.asp
Thanks for posting in this thread while there is an earlier one with the
same message by the way.

Cor


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.