delphi Sqlite3 数据库的问题
我在delphi7中写入数据库的数据!主程序为关闭时,写入和读出均成功!可是当程序关闭后!再重新启动时,从数据库中读取数据读不出来!而且数据库的文件数量为 0;怎么回事呢?这是我的写入代码:
sldb.BeginTransaction;
sSQL := 'INSERT INTO PlanTable(FTP,User,PassWord,Port,Passive,Folder,Filter,TranSport,BackUpMode,Attribute,Name)VALUES'+'("'
+Trim(FTPAddressEdit.Text)+'","'
+Trim(UserEdit.Text)+'","'
+Trim(PassWordEdit.Text)+'",'
+Trim(PortEdit.Text)+',1,"'
+Trim(ListViewFolder.Selected.Caption)+'","'
+Trim(ListViewFilter.Selected.Caption)+'","'
+Trim(CboxTransport.Text)+'","'
+Trim(CboxBackUpMode.Text)+'","'
+Trim(AttributeEdit.Text)+'","'
+Trim(EditSchemeName.Text)+'");';
sldb.ExecSQL(utf8encode(sSQL));
sldb.Commit;
///FTP用户信息
sldb.Free;
这是读出代码:
List := TStringList.Create;
slDBPath := ExtractFilepath(application.exename)+ 'User.db';
slDb := TSQLiteDatabase.Create(slDBPath);
sltb := slDb.GetTable('SELECT Name FROM PlanTable');
if sltb.Count > 0 then
List.Add(sltb.FieldAsString(sltb.FieldIndex['Name']));
ShowMessage(IntToStr(sltb.Count));
for I:=0 to List.Count-1 do
begin
with ListView1 do
begin
ListItem :=Items.Add;
ListItem.Caption:=List.Strings[i];
end;
end;
List.Free;
sldb.Free;
到底问题出在哪里!请高人指点!
答案:Delphi7 sqlite3 我使用aslite3控件连接的,现在在向数据库中插入数据时//Insert into table往数据表插入数据 end; Connection1.EndTrans; ..
上一个:为什么我的电脑装不了delphi2010
下一个:用delphi做易做图接收程序,怎么不行呀?我用的spcomm控件