当前位置:编程学习 > Delphi >>

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; 到底问题出在哪里!请高人指点!
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,