473,383 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Weird problem with PDO/ODBC and Access

I have an Access database and a table. One of the columns was a memo
field. If I execute a 'select * from table', all the rows would be
retrieved but the columns after the memo column had null data.

If I moved the memo field to the end and executed the same SQL the data
was retrieved propery.

Also if I specified the column name by itself (E.g. select phone from
table' ), the data was retrieved.

Has anyone seen this kind of problem with any other databases where a
memo field must be the last one?

Aug 13 '06 #1
3 3670
On 13 Aug 2006 12:35:17 -0700, "Costas Menico" <cm*****@gmail.com>
wrote:
>Has anyone seen this kind of problem with any other databases where a
memo field must be the last one?
Could it be something to do with the length?
<http://www.php.net/manual/en/function.odbc-longreadlen.phprefers.
--
Locate your Mobile phone: <http://www.bizorg.co.uk/news.html>
Great gifts: <http://www.ThisBritain.com/ASOS_popup.html>
Aug 14 '06 #2
It seems to happen with a short table too.
I am using PHP5.1 under Windows XP of course.

I made a small table and added 2 rows with info in all columns and here
is the layout:

LastName - text,
notes - memo,
addr - text,
zip - text

Here is the code. It fails in $cursor and $cursor1 but works when notes
is last in $cursor2.

<?php
$tbl='tblNotes';

$user='';
$pass='';
$conn = "DSN=mailing;Driver=Microsoft Access Driver";
try {
$dbh = new PDO("odbc:$conn", $user, $pass);

// prints nulls after NOTES
$cursor=$dbh->query("SELECT * from $tbl order by LastName");
foreach ($cursor as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

// Also prints nulls after NOTES
$cursor1=$dbh->query("SELECT LastName, notes, addr, zip from $tbl
order by LastName");
foreach ($cursor1 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

// prints all columns correctly because I moved notes to be last
$cursor2=$dbh->query("SELECT LastName, addr, zip, notes from $tbl
order by LastName");
foreach ($cursor2 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}

} catch (PDOException $e) {

echo $e->getMessage();

}
$dbh = null;
?>
Result when you run this:
$cursor
doe|mm|||
smith|xx|||

$cursor1
doe|mm|||
smith|xx|||

$cursor2
doe|mm|120 main street|10006|
smith|xx|320 bway|10007|

Aug 14 '06 #3

Costas Menico wrote:
I have an Access database and a table. One of the columns was a memo
field. If I execute a 'select * from table', all the rows would be
retrieved but the columns after the memo column had null data.

If I moved the memo field to the end and executed the same SQL the data
was retrieved propery.

Also if I specified the column name by itself (E.g. select phone from
table' ), the data was retrieved.

Has anyone seen this kind of problem with any other databases where a
memo field must be the last one?
That's a known limitation of ODBC I think. Once the driver goes into
blob retrieval mode, it can't retrieve fixed width columns anymore.

Aug 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: DD | last post by:
Hello, Could anyone please help me?? Is there somebody who could explain me how to make a connection to a access database with a python cgi script. I would like to use common sql commands in my...
13
by: Wolfgang Kaml | last post by:
Hello All, I have been researching newsgroups and knowledgebase all morning and not found a solution that would solve the problem I have. I am having an ASP or ASPX web page that implement a...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
7
by: Neil Ginsberg | last post by:
I'm having some problems with an Access 2000 MDB file with a SQL Server 7 back end, using ODBC linked tables. I previously wrote about this, but am reposting it with some additional information and...
2
by: somersbar | last post by:
im trying to get a table from a microsoft access database on a simple web form using visual basic.net. ive set up the database as a file dsn. this is my connection string: DBQ=C:\Program...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
1
by: Chevylover54 | last post by:
We have been using ODBC connections that are in the registry of the computer. However these connections aren't in by default so when a new user uses the Access program or when a current user goes to...
3
by: ericooi1976 | last post by:
My problem was it will prompt this message "An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred in system.data.dll", when i click many time of a button "A" that will call the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.