Quantcast
Channel: Recent Topics - Forum - Embarcadero Community - Embarcadero Community
Viewing all 3677 articles
Browse latest View live

TADOConnection / TADOQuery and result in unicode is impossible? - by: Remco

$
0
0
Recently we wanted to check if our application can work with a non western characterset. For example: greek(1253).
I needed to implement some changes, one of which was to force our application to read the result from a select SQL query into a UnicodeString, instead of AnsiString to make the app independent of a character set. The same goes for write (UPDATE table SET column=?). So I changed some AnsiString to UnicodeString's and started testing.
Easy does it. Right? No.

Let start with the writing, that was changed easily by changing the parameter datatype from ftString to ftWideString. Constructed a UnicodeString with some special characters, et voila, tested and confirmed. The data is stored correctly in the database.

But the reading the same data back turns out to be not that straight forward as I would have thought. For some reason I constantly get to ANSI converted characters back, regardless of how I set the fieldtype or how I read from the TField.
I changed the fieldtype of the TField from ftString to ftWideString. Then I read the text from field->AsString (or field->AsWideString). The text is now in a UnicodeString object, but is not real unicode data. In fact, its still ANSI below the surface, or some other ill whar's.

This is what I do:


I have tested this with 3 different database brands and its supplied ODBC connectors: MSSQL, Sybase and MySQL.

MSSQL and Sybase drivers both render the same issue. I can't find a way to read UnicodeString properly.
MySQL, when using its supplied ANSI driver, showed the same issue - of course.
But the MySQL Unicode driver proved working correctly. (and, next to that, the FieldType is now automatically ftWideString, no need to set it from ftString).
Next to ADO, I also tested all of the above with FireDAC. Though results differ somewhat from ADO, It did not return proper unicode for MSSQL, Sybase and MySQL ANSI. It did return correctly with the MySQL Unicode driver, just like ADO did.

What is going on here? The goal is to get it working with Sybase and TADOConnection.
It seems to me that, for some reason, the ODBC driver for MSSQL and Sybase is set to convert data to ANSI. Obviously not what I want. How do I force this to return unicode (using ftWideString) - and get proper UTF16 unicode in my UnicodeString?

Did some extra research: It looks like ADO is NOT initializing the ODBC drivers with ODBC version 3 or 3.8. Meaning, that drivers may fall back to ODBC 2, and ANSI conversion enabled as a result.
The MySQL unicode driver proved that both ADO and FireDAC both are capable of working in unicode mode.

I am probably missing something obvious and I just don't see it. Or something is wrong in the way ADO 'talks' to the driver causing the drivers (MSSQL and Sybase) to switch to ANSI mode.

Any thoughts on next steps to try?

How to copy animated gif to album (camera roll)? - by: Karu

$
0
0
My app creates animated GIF programmatically. The animated gif is saved in the app's private storage. How can I share this image or copy it to the device's album or camera roll? I have tried to use TShowShareSheetAction object, but it only accepts a single bitmap to share - while in my case the animated GIF doesn't have a single bitmap. I am using TBitmap.LoadFromFile() to load the bitmap from the animated gif file. But it reads only the first bitmap. As a result, when the image is shared, it has a single frame, and does not animate.

Is there a solution for this problem? How can I copy or share the entire animated GIF file contents? I will really appreciate any help on this. Thank you in advance.

Nesting a dataset in a nested dataset (ERROR: Invalid Field Type) - by: Lucio

$
0
0
Hello everyone,

I have a problem when I go to create a dataset with datasets nested at more than one level and I run the "CreateDataSet" ("TClientDataSet").
He replies: "Invalid Field Type".

This problem is not generated when there are datasets in one level.

I report the recursive function:

procedure createNestedDataSetFromDataset(_fieldDef: TFieldDef;_dataSet: TDataSet);
var
_field: TField;
_dataSetAppo: TDataSet;
begin
for _field in _dataSet.Fields do
begin
_fieldDef.ChildDefs.Add(_field.FieldName, _field.DataType,_field.Size);
if _field.DataType = ftDataSet then
begin
_dataSetAppo := TDataSetField(_field).NestedDataSet;
_dataSetAppo.FieldDefs.Clear;
createnestedDatasetFromDataset(
_dataSet.FieldDefs.Find(_field.FieldName),
_dataSetAppo
);
end;
end
end;

And the code where we call it:

function createDSStructure:TClientDataSet;
begin
Result := TClientDataSet.Create(nil);

Result.FieldDefs.Clear;
Result.FieldDefs.Add('FieldString1',ftString,50);
Result.FieldDefs.Add('FieldString2',ftString,50);
.
.
.

Result.FieldDefs.Add('DataSetField1',ftDataSet,50);
createnestedDatasetFromDataset(
Result.FieldDefs.Find('DataSetField1'),
MyDataSetWidthNestedDataset
);
Result.CreateDataSet;
end;

raised exception class EListError with message 'Item not found'. - by: Frank

$
0
0
Get this message : Project BusLocate.exe raised exception class EListError with message 'Item not found'. for some unknown reason. How do I even debug this? What control uses EList? This error comes up on the Application.CreateForm after Application.Initialize.

Apparently has something to do with TGestureManager. If I delete that off of the form I get past this problem.
The gestures were working fine at one point and it just broke on its own.

Using TFDMSAccessService to "unset" the password on an MS Access compacted datab - by: Roger

$
0
0
Using TFDMSAccessService to "unset" the password on an MS Access compacted database

I have a local MS Access database. I am using FireDAC with C++ to "compact" the database.
I do this using TFDMSAccessService. I want the compacted database to have no password.
The database I am compacting does have a password. I have two paramters to set up prior
to calling TFDMSAccessService::TFDMSAccessService. These are

"Password"

and

"ResetPassword".

What do I set these two to in order to achieve may aim?

ie is Password needed to open the database to be compacted or to set a password
on the compacted database?

Does "ResetPassword = true" cause the password on the compacted database to be
cleared (ie no password) or does this actually set the password on the compacted
database to the new value in "Password"? (in which case it would have been better
named as "SetPassword").

First attempt at 10.2 and 64 bit... - by: Mark

$
0
0
Hello,

Attempting to port a small application to 10.2, 64 bit.
The program complies and runs without issue in 32 bit.
The program complies, no errors/warnings and does not run in 64 bit.
The computer is 64 bit W7.
Running dependency walker in profile mode these are the last 3 lines.

Loaded "COMDLG32.DLL" at address 0x000007FEFEE30000. Successfully hooked module.
Loaded "COMCTL32.DLL" at address 0x000000006EE90000. Successfully hooked module.
Unloaded "COMCTL32.DLL" at address 0x000000006EE90000.

Searching the web, no joy. Searching help files, no joy.
Do I need to make a custom manifest? Currently the manifest is set to "Auto generate".

Thanks,

Mark

TidUDPServer not listening to all interfaces - by: Edmund

$
0
0
(fourth time trying to post this as I'm always being blocked because of mentioning sql statements..)

I have a TIDudpserver and a memo component on a form. I set the udpserver's binding to 0.0.0.0:514.
I activate it. My system has two interfaces.. (A and B).

On A, the idudpserver component receives the message and dumps it to the memo component.
But it ignores things coming from B.

Am I missing anything?

Thanks

Edmund

PS: While I could've sworn I posted something like this somewhere, I can't seem to find it.

confused with forum usage - by: Edmund

$
0
0
Can someone please clarify the point of the "Welcome forum.." and the "Programming" forum? Are they one and the same or two different forums with different topics?

Also.. what exactly is the ETA on the new forum/community thing? This no-newsgroup setting is painful to
use. Posts requiring moderation is important; but needing 1 business day on a community/peer-to-peer
support forum is a tad bit too harsh, unless there are community members who are moderators.

The thing is, when I post, and I need to wait a day, I sometimes forget if I even posted anything (memory
isn't as good as it was) and I question my sanity. This forum is testing my sanity and giving me an
existential crisis. Am I a robot? No.. At least, I don't think so. The good thing is with the "I'm not a robot"
reCaptcha is that it makes you write concise and to-the point messages... ;P

Thanks

Edmund

Help setting up FastMM in C++Builder - by: Patrick

$
0
0
I am trying to use FastMM version 4991 in C++Builde XE4 32bit VCL platform. I followed the usage instructions below but I am getting one error: [bcc32 Error] FastMM4BCB.cpp(63): E2528 pragma directive option -x must be set before compilation begins. I don't know what Option -x is. Can you tell me how to fix this?


Description:
FastMM support unit for C++ Builder. Loads FastMM4 on startup of the Borland
C++ Builder application or DLL.

Usage:
1) Copy FastMM4BCB.cpp, FastMM4.pas, FastMM4Message.pas, FastMM4Options.inc,
and FastMM_FullDebugMode.lib to your source folder.
2) Copy FastMM_FullDebugMode.dll to your application's .exe directory (if you
intend to use FullDebugMode).
3) To your project, add FastMM4Messages.pas first, then FastMM4.pas, then
FastMM4BCB.cpp. On compiling the .pas files, .hpp files are created and
imported by the subsequent files.
4) Add USEOBJ("FastMM4BCB.cpp") to your project file, BEFORE any other
USEFORM directives.
5) Under the Project -> Options -> Linker menu uncheck "Use Dynamic RTL"
(sorry, won't work with the RTL DLL).
FastMM will now install itself on startup and replace the RTL memory manager.

Flush and release TFileStream - by: Hamidreza

$
0
0
Hi,
I am using TFileStream to save big amount of data. Everything works fine except the fact that since the size of the data is big, I need to flush and release the filestream object so that I get no memory issue.
Please advise if there is any way to do that without needing to close and re-open the file (with append probably) to manage the memory usage?

Regards,
Hamidreza,

Save New VCL Forms Application Question - by: Earl

$
0
0
When saving a new VCL Forms Application in C++ Builder 2010, only one project name was required. In C++ Berlin 10.2, two project names are required. One gets a .h extension and the other gets a .cbproj extension and the first part of the name, before the extension, cannot be the same.

Why are two different project names required now whereas only one was required before?

Just curious...
Earl Staley

I set up dbgrid column width at design time, but doesn't show on runtime, why? - by: alex

$
0
0
I setup each column width and the column order at design time by use the column editor. but at runtime, the dbgrid doesn't show as I want, just show as it is without any setting. why?

Convert HTML to PDF (Android) - by: Pablo

$
0
0
My program (Delphi XE 8 - Android) generates a report in HTML format.
The HTML report is quite simple: some tables and up to four images.
I need to convert this HTML file to PDF.
I've been looking around and found the "HTML Editor Library". This library is quite expensive for someone who only needs the HTML to PDF conversion feature. I was wondering if anybody knew of a specific product for my needs or another way to do this.
As an alternative, I thought that maybe there is some way to use Google Drive from inside my program to convert the HTML to PDF and store it in Drive. This has the disadvantage of requiring an Internet connection and a gmail account, but it is better than nothing.
Another possibility (or maybe it is the same) is Chrome's "save as pdf" feature, in case it can be called from inside my program.
Thanks in advance
Regards
Pablo

Unable to Make SQLite field NULL - by: Earl

$
0
0
I have an SQLite double field, 'DateLeft', which is a TDate to display a date value. The problem is when the 'DateLeft' value is posted and the field is blank, the posted value is 0, which displays the date 12/30/1899. I tried running this utility program to force the field to NULL. It didn't work.

FDQuery1->First();
while (!FDQuery1->Eof) {
FDQuery1->Edit();
if (!VarIsNull(FDQuery1->FieldByName("DateLeft")->Value))
if (FDQuery1->FieldByName("DateLeft")->Value < 100)
FDQuery1->FieldByName("DateLeft")->Value = NULL;
FDQuery1->Post();
FDQuery1->Next();
}


After running the above code the 'DateLeft' value is still 0 which results in a display value of 12/30/1899.

How can I make the 'DateLeft' value NULL?

Thank you...
Earl Staley

OpenCV in C ++ Builder - by: wayne

$
0
0
Compared to Visual C ++, it's a lot of trouble.
It is also tiring to modify the header file every time.

Is there an easy solution to using OpenCV in C ++ Builder?

HELP in change the numbers in a vector - by: Jessica

$
0
0
Good morning.

So, I've to create a procedure that needs to change the way numbers are shown to the user, "rounding" them. For example, if the number is 2983457, the user must see: 2983400. Any number that has more than 5 characters needs to be "round" like that.


I thought on the following logic:

First, a counter, which counts the characters of each number of the vector being analyzed. Then, I would save the total number of characters in a vector N, and the first 5 numbers (from left to right) in a vector X .....

Then, I should analyse the last character, to see how the number should be rounded, and save this new vector with the numbers rounded correctly

Finally, I should multiply this vectorby 10^N-4.

My problem is, I've no idea how to actually programm this on Delphi.

Any help will be deeply appreciated.

Jessica M.

My debugger cant hit or reach breakpoint event - by: zagrab

$
0
0
Hey Guys i don't know that im making it in the right place but i tried to make a new thread on the forum but it seems there is a bug on it
Would Anyone help me or leave a suggestion for me Please!
my problem is that i made a program act as a debugger okay builded on C++ On Rad Studio Configuration Release Okay? and its working fine on those windows version
7, 8, 8.1, 10
expect Windows XP
int 3 exist but i don't know what is the problem
Also i tried to use other example of Debug Loop but the result still the same
Also used the flush breakpoint
Also i tired On C# Application
and here is my debug loop codes

Firedac + oracle = Empty string value - by: David

$
0
0
Hi all
We have a problem with Delphi Tokyo 10.2.3 Enterprise and oracle 8.1. Using Firedac to read a query that returns varchar2 values gives us the correct amount of records, but every column that is a string value is blank. The same query in ADO returns the correct data.
I have tried updating my OCI but the problem persists.
Can anyone please help?

thanks!

Cheers

Emptying Directory - by: Tom

$
0
0
The following code won't empty the directory passed as 'dir'. At least one file is always left in the directory. When I debug I can verify that all the filenames are included in arFileList and the call to 'length' returns the correct number of the files present in the directory.

procedure DeleteAllFiles(dir: string);
var
i: integer;
YorN: char;
arFileList: TStringDynArray;
begin
if DirectoryExists(dir) then
begin
arFileList := TDirectory.GetFiles(dir);
if length(arFileList) > 0 then
begin
Write('About to delete ' + IntToStr(length(arFileList)) +
' files. Continue? ');
readln(YorN);
if UpCase(YorN) = 'Y' then
for i := 0 to pred(length(arFileList)) do
System.SysUtils.DeleteFile(arFileList)
end
end
end;

The call to this procedure is enclosed in a try..except block and does not throw an exception.

Any ideas?

Thanks...

trouble posting a question - by: jack marison

$
0
0
When I go to ANSWERS and the try to post a question on this web site, clicking the submit button never seems to work.

What am I doing wrong?
Viewing all 3677 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>