|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Parameter it doesn't work (for me) IIHi 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 As you were told last time you posted this question, the wildcard for like
in ADO and ADO.NET is %, not *. Show quoteHide quote "Fia" <fiao***@telia.com> wrote in message news:%2309jVdbOFHA.3444@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 > > > As you were told last time you posted this question, the wildcard for like What has AdoNet to do with a select string?> in ADO and ADO.NET is %, not *. > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.asp Thanks for posting in this thread while there is an earlier one with the same message by the way. Cor 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. Show quoteHide quote "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message news:eQcW52bOFHA.4028@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/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.asp > > Thanks for posting in this thread while there is an earlier one with the > same message by the way. > > Cor > Thank's now it works!!!
Fia Show quoteHide quote "Stephany Young" <noone@localhost> skrev i meddelandet http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.aspnews:%23vEk%23XcOFHA.3668@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" <notmyfirstn***@planet.nl> wrote in message > news:eQcW52bOFHA.4028@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? > > > > Show quoteHide quote > > > > Thanks for posting in this thread while there is an earlier one with the > > same message by the way. > > > > Cor > > > >
datagrid filled from a list
HLP: Retrieving ListView String Information ?syntax to recognize code in a 2nd file Scripting Runtime Question on updating data ARRAYLIST ADDING A CLASS Checking a string for valid date O.T.:Shameless Plug to get Free Software(for me & for you too) How to provide hint on sub params? File Access |
|||||||||||||||||||||||