Very strange problem: Executing my query against MS Access database using
OleDbProvider for Access, I am getting the value for first two columns '0'
instead of '1' in DataGrid. But if I connect to SQL Server using
OleDbProvider, it shows me the correct value i.e. 1 wherever it should be.
To debug i write the query to a file. Now copy the query from that file to
Acess SQL View and run. Here it shows the correct value 1 for the first two
columns wherever it should be 1.
I think this is the problem of OleDbData Provider for Access in .NET.
The first two columns are created on the fly i.e. these columns doesn’t
exist in table I just create as a view. But this query is populating the
correct value for the first two columns when I connect to SQL Server, but
connecting to MS Access using OleDb Provider to .NET it populates ‘0’ in
place of ‘1’ for the first two columns. Rest of the things are ok.
QUERY:
" SELECT "+
" (select Quantity from Items_Detail idt "+
" where idt.Barcode = MB.Barcode "+
" AND MB.inv_date='Friday, September 16, 2005'" +
" ) AS \"Qty on: Friday, September 16, 2005\"" +
" ,(select Quantity from Items_Detail idt "+
" where idt.Barcode = MB.Barcode "+
" AND MB.inv_date='Tuesday, September 20, 2005'"+
" ) AS \"Qty on: Tuesday, September 20, 2005\""+
" , idt.Barcode, idt.Place, idt.Description, idt.[Purchase Date],
idt.[Years Used], idt.[Condition], idt.[Actual], idt.[Elevative],
idt.[Depreciation], idt.[Notebook Value], idt.Present, idt.Absent,
idt.[Absence Reason] " +
" FROM Items_Detail idt, "+
" (" +
// /*The purpose of this query is to return the missing Barcodes in either
of two Dates*/
" SELECT Inv_Date, Barcode FROM Inventory inv "+
" WHERE "+
" inv.Barcode IN (select inventory.Barcode from inventory where
inv_date='Friday, September 16, 2005')"+
" AND inv.Barcode NOT IN (select inventory.Barcode from inventory where
inv_date='Tuesday, September 20, 2005')"+
" OR "+
" inv.Barcode IN (select inventory.Barcode from inventory where
inv_date='Tuesday, September 20, 2005')"+
" AND inv.Barcode NOT IN (select inventory.Barcode from inventory where
inv_date='Friday, September 16, 2005')"+
" ) MB " +
///*Missed Barcodes*/
" WHERE idt.Barcode = MB.Barcode "+
" AND (MB.Inv_Date = 'Friday, September 16, 2005' OR MB.Inv_Date = 'Tuesday,
September 20, 2005') ";
Arif. 2 1670
The Format of SQL Server's Date is different as Access! You can try sign #
instead of ' in Access, or use OleDbParameter and OleDbType.Date.
"Arif" <Ar**@discussions.microsoft.com> дϢ:05**********************************@ microsoft.com... Very strange problem: Executing my query against MS Access database using OleDbProvider for Access, I am getting the value for first two columns '0' instead of '1' in DataGrid. But if I connect to SQL Server using OleDbProvider, it shows me the correct value i.e. 1 wherever it should be.
To debug i write the query to a file. Now copy the query from that file to Acess SQL View and run. Here it shows the correct value 1 for the first two columns wherever it should be 1.
I think this is the problem of OleDbData Provider for Access in .NET.
The first two columns are created on the fly i.e. these columns doesnt exist in table I just create as a view. But this query is populating the correct value for the first two columns when I connect to SQL Server, but connecting to MS Access using OleDb Provider to .NET it populates 0 in place of 1 for the first two columns. Rest of the things are ok.
QUERY:
" SELECT "+ " (select Quantity from Items_Detail idt "+ " where idt.Barcode = MB.Barcode "+ " AND MB.inv_date='Friday, September 16, 2005'" + " ) AS \"Qty on: Friday, September 16, 2005\"" +
" ,(select Quantity from Items_Detail idt "+ " where idt.Barcode = MB.Barcode "+ " AND MB.inv_date='Tuesday, September 20, 2005'"+ " ) AS \"Qty on: Tuesday, September 20, 2005\""+
" , idt.Barcode, idt.Place, idt.Description, idt.[Purchase Date], idt.[Years Used], idt.[Condition], idt.[Actual], idt.[Elevative], idt.[Depreciation], idt.[Notebook Value], idt.Present, idt.Absent, idt.[Absence Reason] " +
" FROM Items_Detail idt, "+ " (" + // /*The purpose of this query is to return the missing Barcodes in either of two Dates*/ " SELECT Inv_Date, Barcode FROM Inventory inv "+ " WHERE "+ " inv.Barcode IN (select inventory.Barcode from inventory where inv_date='Friday, September 16, 2005')"+ " AND inv.Barcode NOT IN (select inventory.Barcode from inventory where inv_date='Tuesday, September 20, 2005')"+ " OR "+ " inv.Barcode IN (select inventory.Barcode from inventory where inv_date='Tuesday, September 20, 2005')"+ " AND inv.Barcode NOT IN (select inventory.Barcode from inventory where inv_date='Friday, September 16, 2005')"+ " ) MB " + ///*Missed Barcodes*/ " WHERE idt.Barcode = MB.Barcode "+ " AND (MB.Inv_Date = 'Friday, September 16, 2005' OR MB.Inv_Date = 'Tuesday, September 20, 2005') ";
Arif.
Thanks Jason,
the type of field is 'Text' not 'Date' for that column. So it must be
treated as a text type field. Another thing is that as I have already
mentioned that to debug i write the query also to a text file. Later i copy
the query and pasted to Access's SQL View. Here it is showing the correct
output. Therefore it is looking to me that it the problem/bug of
OleDbProvider for Access in .NET.
Well I will also try your suggestion and will inform you.
Thanks for your kind support,
Arif.
"Jason W. Sun" wrote: The Format of SQL Server's Date is different as Access! You can try sign # instead of ' in Access, or use OleDbParameter and OleDbType.Date. "Arif" <Ar**@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:05*********************** ***********@microsoft.com... Very strange problem: Executing my query against MS Access database using OleDbProvider for Access, I am getting the value for first two columns '0' instead of '1' in DataGrid. But if I connect to SQL Server using OleDbProvider, it shows me the correct value i.e. 1 wherever it should be.
To debug i write the query to a file. Now copy the query from that file to Acess SQL View and run. Here it shows the correct value 1 for the first two columns wherever it should be 1.
I think this is the problem of OleDbData Provider for Access in .NET.
The first two columns are created on the fly i.e. these columns doesn¡¯t exist in table I just create as a view. But this query is populating the correct value for the first two columns when I connect to SQL Server, but connecting to MS Access using OleDb Provider to .NET it populates ¡®0¡¯ in place of ¡®1¡¯ for the first two columns. Rest of the things are ok.
QUERY:
" SELECT "+ " (select Quantity from Items_Detail idt "+ " where idt.Barcode = MB.Barcode "+ " AND MB.inv_date='Friday, September 16, 2005'" + " ) AS \"Qty on: Friday, September 16, 2005\"" +
" ,(select Quantity from Items_Detail idt "+ " where idt.Barcode = MB.Barcode "+ " AND MB.inv_date='Tuesday, September 20, 2005'"+ " ) AS \"Qty on: Tuesday, September 20, 2005\""+
" , idt.Barcode, idt.Place, idt.Description, idt.[Purchase Date], idt.[Years Used], idt.[Condition], idt.[Actual], idt.[Elevative], idt.[Depreciation], idt.[Notebook Value], idt.Present, idt.Absent, idt.[Absence Reason] " +
" FROM Items_Detail idt, "+ " (" + // /*The purpose of this query is to return the missing Barcodes in either of two Dates*/ " SELECT Inv_Date, Barcode FROM Inventory inv "+ " WHERE "+ " inv.Barcode IN (select inventory.Barcode from inventory where inv_date='Friday, September 16, 2005')"+ " AND inv.Barcode NOT IN (select inventory.Barcode from inventory where inv_date='Tuesday, September 20, 2005')"+ " OR "+ " inv.Barcode IN (select inventory.Barcode from inventory where inv_date='Tuesday, September 20, 2005')"+ " AND inv.Barcode NOT IN (select inventory.Barcode from inventory where inv_date='Friday, September 16, 2005')"+ " ) MB " + ///*Missed Barcodes*/ " WHERE idt.Barcode = MB.Barcode "+ " AND (MB.Inv_Date = 'Friday, September 16, 2005' OR MB.Inv_Date = 'Tuesday, September 20, 2005') ";
Arif. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ray |
last post by:
Hi
I need to access an access db via php.
My hosting provider is using php version 4.3.10 on a windows 2003 platform.
I think that php was installed with the Plesk for windows package/control...
|
by: StepUP |
last post by:
I'm a long time developer in Access. Noticing the "Why do IT guys hate
MS Access?" thread made me think of my recent experiences in
experimenting with VB .Net, and specifically, the Datagrid...
|
by: Jim Heavey |
last post by:
Trying to figure out the technique which should be used
to add rows to a datagrid. I am thinking that I would
want an "Add" button on the footer, but I am not quite
sure how to do that. Is that...
|
by: Jennyfer J Barco |
last post by:
Hello, I have a datagrid that brings some information from a query. I need
to have a checkbox in each row so the user can select the rows he wants to
reprint. Is it possible to have a checkbox...
|
by: HS1 |
last post by:
Hello
I have a datagrid to show data for a database table using "seclect * from
tablename"
The datagrid works OK. However, I want to change the name of the fields in
the database to other...
|
by: HS1 |
last post by:
Hello
I have a table in Access Database. This table has a AutoNumber field. I use
a DataGrid to show that table
When I insert a new record in for this table using a DataGrid, there is a...
|
by: Elton Wang |
last post by:
Hi Bruce,
As Cor's suggestion, it's better to post Web DataGrid
questions in either dotnet.framework.aspnet or more
specially in dotnet.framework.aspnet.datagrid group.
Anyway, following code...
|
by: mfreeman |
last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown
below. All I do is loop through the records in the table and update
them without making any changes. Out of 600 records, about...
|
by: tshad |
last post by:
I am trying to connect to my Sql Server 2000 database from my VS 2003
program and get the "provider cannot be found" when I try to connect to the
database. It sees the Server fine but when I tell...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
| |