// CREATE TABLE [tabusers]( // [id] INTEGER PRIMARY KEY AUTOINCREMENT, // [username] CHAR NOT NULL, // [userpwd] CHAR NOT NULL, // [usernickname] CHAR, // [useroffice] CHAR, // [userprofiles] BLOB, // [regdatetime] DATETIME, // [userpermission] CHAR, // [useronline] BOOLEAN, // [usertablename] CHAR); MainForm.Conn.StartTransaction; UserManagerQuery.SQL.Clear; UserManagerQuery.SQL.Text := 'INSERT INTO tabusers(' + // 'username, userpwd, usernickname, useroffice, userprofiles, regdatetime, userpermission, useronline, usertablename)' + // ' VALUES (:username, :userpwd, :usernickname, :useroffice, :userprofiles, :regdatetime, :userpermission, :useronline, :usertablename)'; UserManagerQuery.Params[0].AsString := edtUserName.Text; if Using_Default_Pwd then UserManagerQuery.Params[1].AsString := Default_Password else UserManagerQuery.Params[1].AsString := MD5Print(MD5StringA(AnsiString(edtUserPwd.Text))); UserManagerQuery.Params[2].AsString := edtUserNickName.Text; UserManagerQuery.Params[3].AsString := edtUserOffice.Text; MS := TMemoryStream.Create; ImgUserProfiles.Picture.SaveToStream(MS); MS.Position := 0; UserManagerQuery.Params[4].LoadFromStream(MS, ftBlob); MS.Free; UserManagerQuery.Params[5].AsDateTime := Now; UserManagerQuery.Params[6].AsString := edtUserPermission.Text; UserManagerQuery.Params[7].AsBoolean := False; User_Count := UserListBox.Items.Count; New_user_Name := 'tab_user' + Format('%.3d', [User_Count]);; UserManagerQuery.Params[8].AsString := New_user_Name; UserManagerQuery.ExecSQL; MainForm.Conn.Commit; UserListBox.Items.Add(edtUserName.Text); try // CREATE TABLE "tab_user001"( // [ID] INTEGER PRIMARY KEY AUTOINCREMENT, // [aDate] DATE NOT NULL, // [aComments] CHAR, // [aProgress] CHAR, // [aNote01] CHAR, // [aNote02] CHAR); UserManagerQuery.SQL.Clear; strSQL := 'CREATE TABLE ' + New_user_Name + ' (' + '[ID] INTEGER PRIMARY KEY AUTOINCREMENT,' + '[aDate] DATE NOT NULL,' + '[aComments] CHAR,' + '[aProgress] CHAR,' + '[aNote01] CHAR,' + '[aNote02] CHAR)'; UserManagerQuery.Command.Prepare(strSQL);//注意这里不能用 ExecSQL / Open() / OpenOrExecute 这类东东 UserManagerQuery.Execute(); except on E: Exception do begin ShowMessage(E.Message); end; end;