问题标签 [delphi-5]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
web-services - 使用delphi webservice删除表中的数据
我在delphi中的程序有这个问题。我想用这个请求 url 删除表中的数据:http://localhost:8001/delete/woodSpecie?json={"SessionID":"MVykZKX31d19dYnywxsXM1MdPy0U7VW8","wood_specie_id":"80"}
我实际上正在创建一个 Web 服务。
以下是我的德尔福代码:
发生的事情是它会返回此错误消息:
我真的不知道出了什么问题。我无法删除,而且我的表首先不是空的。而且,我无法看到我所有的例外情况。
delphi - 运行时通过delphi连接odbc数据源
我们可以在运行时创建 ODBC 数据源连接吗?如果是的话,那么你能帮助你如何做到这一点。目前,我是通过控制面板--> 管理工具--> 数据源手动创建 ODBC 数据源连接的。但是我想在用户运行应用程序时在运行时创建它。
谢谢您的帮助。
delphi - 如何在非 unicode Delphi 版本中构造带有变音符号的 WideString?
我正在尝试构建一个(测试)WideString
:
á ( U+00E1 小写拉丁字母 A 带锐音)
但使用它的分解形式:
所以我有代码片段:
除了它似乎不起作用:
这可能是 中的错误MessageBox
,但我要继续说,错误更有可能出现在我的代码中。
我尝试过的其他一些变化:
奖金喋喋不休
delphi - Delphi 5 有排序字典容器吗?
我是 Delphi 5 的新手,正在寻找一个容器(最好是内置的),它可以完成与map
C++ 中相同的工作(即排序字典)。我已经进行了初步的谷歌搜索,但似乎没有任何明显的迹象。请问有人能指出我正确的方向吗?
string - How to convert float or currency to a localized string?
In Delphi1, using FloatToStrF
or CurrToStrF
will automatically use the DecimalSeparator
character to represent a decimal mark. Unfortunately DecimalSeparator
is declared in SysUtils as Char
1,2:
While the LOCALE_SDECIMAL
is allowed to be up to three characters:
Character(s) used for the decimal separator, for example, "." in "3.14" or "," in "3,14". The maximum number of characters allowed for this string is four, including a terminating null character.
This causes Delphi to fail to read the decimal separator correctly; falling back to assume a default decimal separator of ".
":
On my computer, which is quite a character, this cause floating point and currency values to be incorrectly localized with a U+002E (full stop) decimal mark.
i am willing to call the Windows API functions directly, which are designed to convert floating point, or currency, values into a localized string:
Except these functions take a string of picture codes, where the only characters allowed are:
- Characters "0" through "9" (
U+0030
..U+0039
) - One decimal point (
.
) if the number is a floating-point value (U+002E
) - A minus sign in the first character position if the number is a negative value (
U+002D
)
What would be a good way1 to convert a floating point, or currency, value to a string that obeys those rules? e.g.
1234567.893332
-1234567
given that the local user's locale (i.e. my computer):
- might not use a
-
to indicate negative (e.g.--
) - might not use a
.
to indicate a decimal point (e.g.,,
) - might not use the latin alphabet
0123456789
to represent digits (e.g. [removed arabic digits that crash SO javascript parser])
A horrible, horrible, hack, which i could use:
Additional info on the chain of functions the VCL uses:
FloatToStrF
andCurrToStrF
calls:FloatToText
calls:
Note
DecimalSeparator: Char
, the single character global is deprecated, and replaced with another single character decimal separator
1 in my version of Delphi
2 and in current versions of Delphi
delphi - 将货币值设置为 NAN、INF 或 -INF?
我想测试一些代码以确保它可以正确处理和NAN
输入。INF
-INF
我知道存在返回 和的函数NAN
,但作为:INF
-INF
Double
除了在我的情况下,我需要测试 a 何时Currency
是这三个边缘情况值之一。不幸的是,您不能将其中任何一个转换为Double
:
将 a 转换为 a时出现EInvalidOp
Invalid floating point operation异常。Double
NAN
Currency
是否可以将 a 分配NAN
给 a Currency
?
也许,不是可以将 a 分配NAN
给 a Currency
,而是不可能- 我可以忽略这种边缘情况。
我可以忽略这个边缘情况吗?
是否可以“将货币值设置为 NAN、INF 或 -INF?”
delphi - 检测何时有人在释放我的 TADOConnection 后使用它?
一位同事今天来找我,代码在 Windows XP 上运行但在 Windows 7 上失败:
用户登录“SalesOrdersystem”失败
我的物理调试告诉我,他正在对已关闭或忘记打开的数据库连接运行查询。
从 ADO2.6 开始,在 Windows Vista 中,
PersistSecurityInfo
连接字符串中的默认值为False
,而不是True
。在 Windows Vista 之前的连接字符串,例如:
连接打开后将密码保留在连接字符串中,这相当于:
从 Windows Vista 开始,默认情况下,密码会从连接的
ConnectionString
属性中删除:这相当于
我知道我的同事正在经历这种密码被删除的行为。然后,当连接关闭时,他试图打开一个查询(即 ADOQuery.Open),该查询试图打开连接。但是如果没有在连接字符串中保存密码,他会得到原来的错误
问题变成了,“你为什么要使用连接而不先打开它?”
我们将其追溯到(多线程代码)他使用的连接后来被释放:
伪代码:
而不是
开玩笑地说,我建议他可以通过将连接字符串更改为包含以下内容来掩盖错误并留下潜在的崩溃PersistSecurityInfo=True
:
他做到了。
我们有一些在内部使用ADOConnection
对象的库代码。我希望能够从以下位置更改我的代码:
到
但我确信它会引入错误,而这些错误曾经发生过。
我在想的是某种闭包,我可以在其中OnConnect
向连接对象注入处理程序:
但是 Delphi 没有匿名事件处理程序。
任何人都可以想出一种方法来提醒人们在释放对象后使用它吗?
注意:我知道我的要求不支持。考虑到现实的局限性,我正在寻求最佳黑客的想法。
delphi - FastMM 无法检测到内存泄漏
我在 Delphi5 的应用程序中使用 FastMM 4.97。
一切正常,如果我从 IDE 运行我的应用程序并故意泄漏以进行测试。我得到适当的通知和错误日志。
但是,如果我在 IDE 之外运行我的应用程序(例如从 Windows 资源管理器运行 .exe 文件),则什么也不会发生。
我错过了什么吗?这种行为是有意的吗?可以改变吗?
delphi - 如何在 Delphi 中打开带有 http 身份验证的 url?
如何打开需要“http 身份验证”以透明方式传递登录名和密码的 url(浏览器窗口)?delphi 中的旧应用程序需要从 Reporting Services 中打开“.aspx”中的报表。
谢谢, 塞尔索
delphi - Delphi 5 incompatible with library
I am trying to add an Advantech (BDaqCL.pas) library to my application project in Delphi 5 but the .PAS file is riddled with code such as:
which causes the error:
Is this a feature of the later versions of Delphi which is not compatible in D5? If so is it worth manually changing everyone (there are many) or am I bound to run in to much deeper problems?
Edit: Most the enumerations are as above but there's also plenty of more complex like below. Far too many to do manually:
Edit: I'm beginning the process of declaring them as constants. Could anyone tell me if it's correct to do the following
where I am leaving the var declaration listed and moving the const declarations to the top.
I am unsure what to do when the const is not equal to anything, for e.g.
As you can see I have my work cut-out so it's best to make sure I'm doing it right first. Thanks