Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / October 2005

Tip: Looking for answers? Try searching our database.

Results of query are not returned in DataAdapter Fill method

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bordsby - 21 Oct 2005 07:26 GMT
Windows Form Application, MSAccess Database, VB.NET

I am having a very strange problem with the OleDb.OleDbDataAdapter.Fill
method.... I have used this method thousands of times with success and
have never had any problems, but recently I have a query that will
definitely return multiple rows when run from inside MSAccess, but when
passed through the OleDb.OleDbDataAdapter.Fill method, the result comes
back with no rows, but I know *for sure* that the query does indeed
come back with some rows.  I have output the query one line before the
fill method is called and then run it from inside MSAccess and rows are
returned, but then nothing comes back in the fill method.  This method
has worked perfectly with many, many other queries...... so, what's
different about this query?  This is the first time I have passed use
the 'Like' operator in the 'WHERE' clause of the query... if I take the

'Like' operator out, everything is fine, but when I put it in, the
query still selects rows when run inside MSAccess, but the fill method
gets nothing.

Has anybody ever experienced this particular symptom?  I have always
been successful in binding a datagrid to an MSAccess table, but as soon
as I put the 'Like' operator in the query, everything is ignored... I
pasted the few relevant lines of code here, but not the query, since
that is not critical, becuase I am sure it returns rows and is
syntactically correct.
____________________________________________________________________________
   Public connStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
source=data.db"
   Public conn As OleDb.OleDbConnection = New
OleDb.OleDbConnection(connStr)
   Public q As OleDb.OleDbCommand = New OleDb.OleDbCommand("", conn)
   Public da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter
   Public ds As DataSet = New DataSet
   Public b2b_dt As DataTable = ds.Tables.Add("b2b")

   b2b_dt.Clear()
   q.CommandText = [long select query]
   da.SelectCommand = q
   da.Fill(Me.b2b_dt)
_____________________________________________________________________________
Bart Mermuys - 21 Oct 2005 16:10 GMT
Hi,

> Windows Form Application, MSAccess Database, VB.NET
>
[quoted text clipped - 14 lines]
> query still selects rows when run inside MSAccess, but the fill method
> gets nothing.

When using JET though ADO(.NET) you must use different wildcarts, % instead
of * and _ instead of ?.

HTH,
Greetings

> Has anybody ever experienced this particular symptom?  I have always
> been successful in binding a datagrid to an MSAccess table, but as soon
[quoted text clipped - 17 lines]
>    da.Fill(Me.b2b_dt)
> _____________________________________________________________________________
bordsby - 21 Oct 2005 16:43 GMT
Bart,

Thank you very much, that was indeed the problem... so I use  * for the
wildcard when running the query inside MSAccess, and  %  for the
wildcard when going through ADO.NET

That really helps me out, I appreciate it

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.