Text field showing as blob in DBGrid lazarus / 16-Databases ---------------------------------------------------------------------- dkjMusic · 2011-01-19 01:39 Has there been any fix to this yet? Is there any way to display the text? ---------------------------------------------------------------------- Phil · 2011-01-19 01:46 Not sure what you mean. Are you referring to a bug report? Thanks. -Phil ---------------------------------------------------------------------- dkjMusic · 2011-01-19 02:41 Quote from: Phil on January 19, 2011, 02:46:32 amNot sure what you mean. Are you referring to a bug report? Thanks. -Phil When I fill a DBGrid with a query on a MySQL database, integer and date fields show correctly but text fields show as "(blob)". I was wondering if there is a way to have text fields displayed correctly. Googling showed this had been a problem in the recent past and I was wondering whether there is a solution yet. ---------------------------------------------------------------------- Phil · 2011-01-19 02:54 Are you using the components from the SQLdb tab? That's a separate package, I think. I haven't used MySQL, but those components work with Sqlite text fields (VARCHAR). Thanks. -Phil ---------------------------------------------------------------------- dkjMusic · 2011-01-19 03:10 Quote from: Phil on January 19, 2011, 03:54:36 amAre you using the components from the SQLdb tab? That's a separate package, I think. I haven't used MySQL, but those components work with Sqlite text fields (VARCHAR). Thanks. -Phil Yes, I'm using the SQLdb components. If DBGrid will display SQLite text fields, I'll check it out. Thanks for your input. That is, if I can figure out why I get "/usr/bin/ld: cannot find -lsqlite" when I try to install the SQLite packages. ---------------------------------------------------------------------- Phil · 2011-01-19 03:24 I created my Sqlite database from XML and in the code for doing that I find this comment: "Note can't use TEXT or REAL as data type for some reason with TSqlite3Dataset". That's why I created the text fields a VARCHAR. Maybe that limitation has something to do with your problem as well. I'm on Mac, where all Macs have Sqlite already installed, so I don't think I can help you much with installing it. Thanks. -Phil ---------------------------------------------------------------------- Lacak2 · 2011-01-20 06:32 This problem was already discussed : http://lazarus.freepascal.org/index.php/topic,5321.msg56151.html#msg56 151 ---------------------------------------------------------------------- dkjMusic · 2011-01-20 11:41 Quote from: Lacak2 on January 20, 2011, 07:32:36 amThis problem was already discussed : http://lazarus.freepascal.org/index.php/topic,5321.msg56151.html#msg56 151 I know. That's why my post asked "Has there been any fix to this yet?" Anyway, Phil's replies got me to look at SQLite. I was using a MySQL database, converted from MSAccess with Kexi, and I'm now using a SQLite version and don't have to mess with a server and user account administration. PLUS the Sqlite3Dataset1 with DBGrid now shows the Text fields just fine, which solves my original problem. Thanks to Phil for putting me on the right track. I'm new to Lazarus and database programming and appreciate the help from all of you. ---------------------------------------------------------------------- cpalx · 2011-01-20 14:54 cast your field do something like this: select cast(yourfield as varchar) as name from table that will solve your problem ---------------------------------------------------------------------- Phil · 2011-01-20 15:28 Does that work with Sqlite too? That might explain why I couldn't use TEXT fields. Thanks. -Phil ---------------------------------------------------------------------- jamj · 2011-02-20 11:03 I had the same problem. Finally I have solved the problem.  For some reason the mysql components do not realize that text and blob data are diferent so for the libraries is the same type. When you receive the "blob" the data is still there, you only have to extract the data with a cast. I did this to get the data: var e : string; begin   e:= MY_QUERY.Fields[1].AsString; Where "fields" represents the colum 1 data. MY_QUERY is a TSQLquery component.