InsertSQL lazarus / 16-Databases ---------------------------------------------------------------------- Deepaak · 2017-10-14 06:47 Cannot insert Record. What Wrong am i doing. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Query.SQL.Add('Insert into Test(name) values(' +  '''Rohit''' + ')');  Query.ExecSQL; ---------------------------------------------------------------------- Deepaak · 2017-10-14 06:54 This also not Working.... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Query.InsertSQL.Add('Insert into Test(name) values(' +  '''Rohit''' + ')');  Query.Open; ---------------------------------------------------------------------- taazz · 2017-10-14 07:15 ins't name a keyword in SQL? have you tried to enclose in double quotes or the escape character of your server? ---------------------------------------------------------------------- Deepaak · 2017-10-14 07:28 Tried. used other words in place of name. but not working. using Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i MSSQL SERVER 2008R2 EXPRESS EDITION ---------------------------------------------------------------------- fred · 2017-10-14 07:35 What error do you get? ---------------------------------------------------------------------- taazz · 2017-10-14 07:41 I'm guessing you have a table named Test which has a field named name in that case this should work Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Query.SQL.Text := 'INSERT INTO Test ([Name]) VALUES('+QuotedStr('Rohit')+')';Query.ExecSQL;  SQL.TExt must be Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i INSERT INTO Test ([Name]) VALUES('Rohit')  This command is correct. if it does not execute then you have a problem with the connection chain post a sample so we can try. ---------------------------------------------------------------------- Deepaak · 2017-10-14 08:24 UR's Query is Executing Without any Errors. But values are not inserted inside table. Select * from Test; is working fine. Connection through ODBC is OK. ODBC1.Connected result is TRUE. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Query.SQL.Text:='INSERT INTO Test ([Name]) VALUES(' + '''Rohit''' + ')';Query.Execute; no error in LazIde. Its working but Fail to Insert Record. I Came around Query.InsertSQL //Any workaround for this statement. Will this, will Work; ---------------------------------------------------------------------- daveinhull · 2017-10-14 08:51 I'm assuming that at some point after the InsertSQL query you are doing a Query.ApplyUpdates and a Transaction.Commit or .CommitRetaining? Just checking