所以我的活动有一个带有2个片段的标签页.
public class RecipeDetailActivity : BaseFragmentActivity<RecipeDetailViewModel>
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.RecipeDetailView);
AttachActionBar();
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.Title = "Recipe details";
var viewPager = FindViewById<ViewPager>(Resource.Id.main_view_pager);
if (viewPager != null)
{
var fragments = new List<MvxViewPagerFragmentInfo>();
fragments.Add(
new MvxViewPagerFragmentInfo("Ingrediente", typeof(RecipeFlavoursFragment), typeof(RecipeFlavoursViewModel)));
fragments.Add(
new MvxViewPagerFragmentInfo("Flavours", typeof(RecipeIngridientsFragment), typeof(RecipeIngridientsViewModel)));
viewPager.Adapter = new MvxFragmentPagerAdapter(this, SupportFragmentManager, fragments);
viewPager.Adapter = new MvxFragmentPagerAdapter(this, SupportFragmentManager, fragments);
var tabLayout = FindViewById<TabLayout>(Resource.Id.main_tablayout);
tabLayout.SetupWithViewPager(viewPager);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我使用以下代码显示此页面.
private void SelectRecipe(RecipeModel recipe)
{
var recipeJson = JsonConvert.SerializeObject(recipe);
ShowViewModel<RecipeDetailViewModel>(new { recipe = recipeJson …Run Code Online (Sandbox Code Playgroud) declare @nr1 decimal(20,19),
@nr2 decimal(20,19)
set @nr1 = EXP(1.0)
set @nr2 = PI();
print @nr1/@nr2
Run Code Online (Sandbox Code Playgroud)
由于EXP和PI是"无限"数字,因此您应该始终有足够的小数来打印
此查询的结果是 0.865255979432265082
对于查询:
declare @nr12 decimal(34,25),
@nr22 decimal(34,25)
set @nr12 = EXP(1.0)
set @nr22 = PI();
print @nr12/@nr22
Run Code Online (Sandbox Code Playgroud)
我得到了结果: 0.865255
所以我的问题是,为什么第一个查询比第二个查询更精确?正如decimal(p,s)在msdn中定义的那样,告诉我第二个查询应该更精确.
所以我有这个“表”,它是查询的结果
SELECT Valoare
FROM GEConfig
WHERE Cimp IN('Societate','Adresa','Banca','CapitalSocial','Cont','CUI','NrRegCom','ModulReceptiiExtCotaTVA')
Run Code Online (Sandbox Code Playgroud)
GeConfig 是一个表,用于配置每个客户端的应用程序,因此上述查询生成的数据对于每个客户端来说都是不同的。
Valoare
========================
1 aaa
2 bbb
3 ccc
4 ddd
5 eee
6 fff
7 ggg
8 hhh
Run Code Online (Sandbox Code Playgroud)
我想旋转这张桌子,使它看起来像
col1 col2 col3 col4 col5 col6 col7 col8
aaa bbb ccc ddd eee fff ggg hhh
Run Code Online (Sandbox Code Playgroud)
我没有任何聚合,我只有一列 8 行,我想将其变成 1 行 8 列。
为什么我想要这个?我必须使用 Rave Report。我尝试过这样的事情
select Valoare
, [1]
, [2]
, [3]
from
(
select Valoare from GEConfig
) x
pivot
(
max(Valoare)
for Valoare in([1], [2], [3])
)p …Run Code Online (Sandbox Code Playgroud) 如何将字段类型从ftFloat转换为ftBCD;
我试过了
for i := 0 to FDataSet.FieldCount - 1 do begin
if FDataSet.Fields.Fields[i].DataType = ftFloat then begin
FDataSet.Fields.Fields[i].DataType := ftBCD;
end;
end;
Run Code Online (Sandbox Code Playgroud)
但是我得到了错误
[DCC Error] E2129 Cannot assign to a read-only property
Run Code Online (Sandbox Code Playgroud)
有没有办法可以将ftFloat的所有数据集字段转换为ftBCD?
我在Delphi中构建了一个数据集,其中我有一个ADOQuery,它从表中选择2个列...我将该ADOQuery中的一个列拖放到一个表单中,如何从该列中获取我的值.我想将这些值放入组合框中.
unit SCArabica;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, Mask, DBCtrls, Grids, DBGrids;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
DBGrid1: TDBGrid;
Label9: TLabel;
DBEdit1: TDBEdit;
DataSource1: TDataSource;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
published
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
end.
Run Code Online (Sandbox Code Playgroud)
数据集代码
unit SCArabicaDataSet;
interface
uses
SysUtils, Classes, FMTBcd, DB, SqlExpr, ADODB;
type
TDataModule1 = class(TDataModule)
ad: TADOConnection;
ADOQuery1: TADOQuery; …Run Code Online (Sandbox Code Playgroud) 我是Delphi编码的新手,在尝试覆盖构造函数时遇到错误,你能告诉我我做错了什么或者我应该做些什么来达到预期的结果.
我想覆盖一个框架的构造函数,以便它可以将标签的Caption包含在特定的文本中.
这是代码
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TfrmMesaj = class(TFrame)
Panel1: TPanel;
private
{ Private declarations }
public
{ Public declarations }
constructor Create(name : string); override;
end;
implementation
{$R *.dfm}
{ TfrmMesaj }
{ TfrmMesaj }
constructor TfrmMesaj.Create(name: string);
begin
inherited;
Panel1.Color := clRed;
Panel1.Caption := name;
end;
end.
Run Code Online (Sandbox Code Playgroud)
当我尝试编译时,我收到以下错误:
[DCC Error] frameMesaj.pas(17): E2037 Declaration of 'Create' differs from previous declaration
[DCC Error] frameMesaj.pas(32): E2008 Incompatible types
Run Code Online (Sandbox Code Playgroud)
我做错了什么,我怎么能得到我想要的?
这个问题应该很简单,但我无法弄清楚答案,也不知道为什么我的存储过程不起作用.
CREATE PROCEDURE spTest_Delete
@ID int
AS
begin tran
declare @err int
declare @errMesage nvarchar(max)
set @errMesage = ''
set @err = 0
delete from Test
where ID = @ID
set @err = @@ERROR
set @errMesage = ERROR_MESSAGE()
if @err = 0
commit tran
else
begin
RAISERROR(N'Could not delete !Error nr: %d. Message: %s', 1, 16, @err, @errMesage)
rollback tran
end
Run Code Online (Sandbox Code Playgroud)
这个过程运行正常,但是如果对delete语句有FK约束,它会遇到错误(这很好),我想抓住错误.
消息547,级别16,状态0,过程spTest_Delete,第12行
DELETE语句与REFERENCE约束"FK_TEstFK_Test"冲突.冲突发生在数据库"Test",表"dbo.Test",列"ID"中.该语句已终止.无法删除!
错误号:547.消息:(null)消息50000,级别1,状态16
我的消息变量总是为null,即使该delete语句引发错误.
我有一个内置SQL的SP,有2个参数,一个是年份,另一个是月份.
在delphi中,我在框架上添加了一个TDateTimePicker,以便让用户选择月份和年份.
如何从TDateTimePicker检索年/日的值?
我试过DateTimePicker2.Date;但是这给了我一个格式为"xx/xx/xxxx"的日期
我想得到实际的年/月
就像是
int year ;
year := DateTimePicker2.Date.Year;
Run Code Online (Sandbox Code Playgroud)
有什么办法可以实现吗?
我一直在努力将运行时创建的表单移动到主窗体的右下角.
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
procedure Button1Click(Sender: TObject);
// procedure FormClick(Sender: TObject);
private
{ Private declarations }
// procedure WindowPosChanging(var Msg : TMessage); message WM_WINDOWPOSCHANGING;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
F1 : TForm;
begin
F1 := TForm.Create(nil);
F1.Height := 300;
F1.Width :=300;
F1.Position …Run Code Online (Sandbox Code Playgroud) 我有以下问题.我创建了一个发送带.xls附件的电子邮件的Windows服务.如果我用Windows Live Mail或Web Mail打开电子邮件,它可以工作,我可以看到附件.当我尝试使用Microsoft Outlook 2010打开电子邮件时,问题就出现了,附件不存在,我不知道我的代码有什么问题.
电子邮件标题看起来像这样
Return-Path: <no-reply@asdf.ro>
Delivered-To: sebi.ciuca@asdf.ro
Received: (qmail 25352 invoked by uid 500); 15 Jul 2015 14:58:23 -0000
Received: by simscan 1.4.0 ppid: 25345, pid: 25349, t: 0.0443s
scanners: attach: 1.4.0 clamav: 0.98.5/m:
Received: from unknown (HELO ab-c11) (task.test@asdf.ro@111.111.111.111)
by mail.absoft.ro with ESMTPA; 15 Jul 2015 14:58:22 -0000
From: "no-reply@asdf.ro" <no-reply@asdf.ro>
Subject: Test Report
To: "Test test" <sebi.ciuca@asdf.ro>
Content-Type: Multipart/Alternative; boundary="wm32hkCMsS=_xUqKLF1OiOMUAOi7ru4ljM"
MIME-Version: 1.0
Date: Wed, 15 Jul 2015 17:58:21 +0300
Run Code Online (Sandbox Code Playgroud)
我用来生成电子邮件的代码是
ExecReport;
var …Run Code Online (Sandbox Code Playgroud) delphi ×6
sql-server ×3
sql ×2
bcd ×1
c# ×1
casting ×1
constructor ×1
database ×1
datasource ×1
decimal ×1
delphi-xe7 ×1
email ×1
forms ×1
indy ×1
mvvmcross ×1
outlook ×1
overriding ×1
pivot ×1