Recent

Author Topic: MSSQL - TABLE READ ONLY AFTER CREATE  (Read 4753 times)

lublinkermi

  • New Member
  • *
  • Posts: 46
MSSQL - TABLE READ ONLY AFTER CREATE
« on: February 15, 2016, 07:12:57 am »
Hi I have a problem with MsSQL Server 2008 using Zeos.
Code: Pascal  [Select][+][-]
  1.   ZConnection1.LibraryLocation:=ExtractFilePath(Application.ExeName)+'msdblibd.dll';
  2.   INI := TINIFile.Create(ExtractFilePath(Application.ExeName) + 'wfmag.ini');
  3.   serwer:=Ini.ReadString('polaczenie','host','localhost');
  4.   baza:=Ini.ReadString('polaczenie','baza','wfmag');
  5.   user:=Ini.ReadString('polaczenie','uzytkownik','root');
  6.   haslo:=Ini.ReadString('polaczenie','haslo_bazy','root');
  7.   snip:=Ini.ReadString('polaczenie','snip','root');
  8.   nrkontrah:=Ini.ReadString('polaczenie','nrkontrah','');
  9.   INI.Free;
  10.  
  11.   If trim(serwer)='' then serwer:='localhost';
  12.   If trim (baza)='' then baza:='wapro';
  13.   If trim (user)='' then user:='sa';
  14.   If trim(haslo)='' then haslo:='Wapro3000';
  15.  
  16.   Zconnection1.HostName:=serwer;
  17.   Zconnection1.Database:=baza;
  18.   Zconnection1.User:=user;
  19.   Zconnection1.Password:=haslo;
  20.   ZConnection1.Protocol:='FreeTDS_MsSQL-7.0';
  21.   try
  22.   Zconnection1.Connected:=true;
  23.  
  24.   except
  25.   begin
  26.   showmessage ('Error MSSQL');
  27.   Application.Terminate;
  28.   end;
  29.   end ;
  30.  
  31.  

I create table like this

Code: Pascal  [Select][+][-]
  1. wapro_uwagi.SQL.Text:='IF NOT EXISTS (SELECT  *    FROM     sysobjects';
  2. wapro_uwagi.SQL.Text:=wapro_uwagi.SQL.Text+' WHERE  name = ''uwagi'' AND xtype = ''U'') CREATE TABLE [dbo].[UWAGI]([uwagi_id] [int] IDENTITY(1,1) NOT NULL,[uwagi_kontrahent] [int]  NULL,[uwagi_data] [date] NULL,[uwagi_opis] [varchar](50) NULL,[uwagi_status] [smallint] NULL,[uwagi_tresc] [text] NULL,)';
  3. wapro_uwagi.ExecSQL;
  4. wapro_uwagi.SQL.Text:='select * from uwagi';
  5. wapro_uwagi.Open;  
  6.  

Table has been crated, but is read only with any data controls like dbgrid, dbnavigator.
Then I use SQL Server Management Studio as a same user and password I can modify this table.

 What  can I do wrong?
Please help me.

paweld

  • Sr. Member
  • ****
  • Posts: 461
Re: MSSQL - TABLE READ ONLY AFTER CREATE
« Reply #1 on: February 15, 2016, 09:38:57 am »
Sprawdź czy query (wapro_uwagi) nie jest ReadOnly
Best regards
paweld

lublinkermi

  • New Member
  • *
  • Posts: 46
Re: MSSQL - TABLE READ ONLY AFTER CREATE
« Reply #2 on: February 15, 2016, 05:59:32 pm »
No any element has r/o attribute

miab3

  • Full Member
  • ***
  • Posts: 144
Re: MSSQL - TABLE READ ONLY AFTER CREATE
« Reply #3 on: February 16, 2016, 03:03:38 pm »

korba812

  • Sr. Member
  • ****
  • Posts: 304
Re: MSSQL - TABLE READ ONLY AFTER CREATE
« Reply #4 on: February 16, 2016, 03:53:55 pm »
Maybe You should commit transaction after creating table?

lublinkermi

  • New Member
  • *
  • Posts: 46
Re: MSSQL - TABLE READ ONLY AFTER CREATE
« Reply #5 on: February 22, 2016, 03:50:23 pm »
Doesn't work. But I can manipulate on sql using ExecSQL statement.

 

TinyPortal © 2005-2018