0
我想通過使用Synapse庫在TinyWebDB組件(AppInventor)中存儲一個值。我設法得到一個價值使用此代碼:如何使用Synapse將值存儲在TinyWebDB中?
procedure GetValue(Tag:String);
var URL: string;
Params: string;
Response: TMemoryStream;
begin
Response := TMemoryStream.Create;
try
URL := 'http://appinvtinywebdb.appspot.com/getvalue';
Params := 'tag=' + EncodeURLElement(Tag);
if HttpPostURL(URL, Params, Response) then
Response.SaveToFile('response.txt');
finally
Response.Free;
end;
end;
但我不能存儲一個值。任何想法或建議? 通過我試圖通過添加其他參數和格式化這樣的代碼來存儲價值的方式:
procedure StoreValue(Tag, Value: String);
var URL: string;
Params: string;
Response: TMemoryStream;
begin
Response := TMemoryStream.Create;
try
URL := 'http://appinvtinywebdb.appspot.com/storevalue';
Params := 'tag=' + EncodeURLElement(Tag)+'&'+
'value='+ EncodeURLElement(Value);
if HttpPostURL(URL, Params, Response) then
Response.SaveToFile('response.txt');
finally
Response.Free;
end;
end;
它似乎並不奏效,因爲響應文件是空的。它應該包含這樣的事情:
[ 「存儲」, 「SomeTag」, 「someValue中」]