当我在SQL Server中创建一个表并保存它时,如果我尝试编辑表设计,比如将列类型从int更改为real,我会收到以下错误:
不允许保存更改.您所做的更改需要删除并重新创建下表.您已对无法重新创建或启用的表进行了更改,该选项会阻止保存需要重新创建表的更改.
为什么我要重新创建表?我只想将数据类型更改smallint
为real
.
该表是空的,直到现在我才使用它.
我想在delphi中更改字符串网格中单元格的背景颜色(不是字体).
只有一个单元格不是行或列.
我可以吗?
RRUZ:你的程序是正确的并且有效但在我的程序中不起作用.
我的程序:
x是整数的全局数组
procedure TF_avalie_salon.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var S: string;
begin
S := StringGrid1.Cells[ACol, ARow];
StringGrid1.Canvas.FillRect(Rect);
SetTextAlign(StringGrid1.Canvas.Handle, TA_CENTER);
StringGrid1.Canvas.TextRect(Rect,Rect.Left + (Rect.Right - Rect.Left) div 2, Rect.Top + 2, S);
if (ARow<>0 )AND(acol<>0)AND(gridclick=true) then
begin
try
gridclick:=false;
x[acol+((strtoint(Edit_hafte.Text)-1)*7),arow]:=strtoint(StringGrid1.Cells[ACol, ARow]);
except
x[acol+((strtoint(Edit_hafte.Text)-1)*7),arow]:=0;
StringGrid1.Cells[acol,arow]:='0';
with TStringGrid(Sender) do
begin
Canvas.Brush.Color := clGreen;
Canvas.FillRect(Rect);
Canvas.TextOut(Rect.Left+2,Rect.Top+2,Cells[ACol, ARow]);
end;
end;
end;
end;
Run Code Online (Sandbox Code Playgroud)
当我使用Canvas.Brush.Color与下面的代码,Canvas.Brush.Color不起作用.如果我在代码下面不活动,我可以更改单元格颜色.但我需要两者.
S := StringGrid1.Cells[ACol, ARow];
StringGrid1.Canvas.FillRect(Rect);
SetTextAlign(StringGrid1.Canvas.Handle, TA_CENTER);
StringGrid1.Canvas.TextRect(Rect,Rect.Left + (Rect.Right - Rect.Left) div 2, Rect.Top …
Run Code Online (Sandbox Code Playgroud) 如何通过制表符或箭头键在Delphi中的字符串网格单元格之间移动?如您所知,delphi中的字符串网格只有一个Tab键顺序,但我需要通过箭头键或制表符在单元格之间移动,以使其更加舒适和用户友好.
我试图使用KeyPress事件,但是这个事件只知道字符,并且不知道像tab这样的控制键......
我需要写一个这样的查询:
SELECT S , D1 , D2 , (D1+D2) as D_Sum , ( (D1+D2) /
(X-(
SELECT SUM(T1+T2)
FROM TBL1
WHERE FCode=81 AND DCode=1 AND S<S
)) AS SSS
FROM TBL1
WHERE Salon=1 AND FCode=81 AND DCode=1
Run Code Online (Sandbox Code Playgroud)
我S<S
在子查询中的where部分有问题.S<S
喜欢FALSE并且不起作用.
第一个S是表中所有记录中的所有s,第二个S存储在每个记录中.
S<S
:我需要选择他们的s小于s的所有记录存储在现在处理的记录中.