S Samo Member Licensed User Longtime User May 16, 2017 #1 Hello, Can you please help me with MYSQL problem. I am using MAriaDB library and B4A latest version This is working: 'MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-16' WHERE `promet`.`ime` = 'JON DOE' AND `promet`.`datum` = '2017-05-14'") When i try to use variable vime not working. Dim vime As String vime = "JON DOE" MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-16' WHERE `promet`.`ime` =" .vime. "AND `promet`.`datum` = '2017-05-20'"") MySQLConnection.ExecuteNonQueryBatch("updatepromet")
Hello, Can you please help me with MYSQL problem. I am using MAriaDB library and B4A latest version This is working: 'MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-16' WHERE `promet`.`ime` = 'JON DOE' AND `promet`.`datum` = '2017-05-14'") When i try to use variable vime not working. Dim vime As String vime = "JON DOE" MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-16' WHERE `promet`.`ime` =" .vime. "AND `promet`.`datum` = '2017-05-20'"") MySQLConnection.ExecuteNonQueryBatch("updatepromet")
R ronell Well-Known Member Licensed User Longtime User May 16, 2017 #2 B4X: Expand Collapse Copy MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-16' WHERE `promet`.`ime` = " &vime& " AND `promet`.`datum` = '2017-05-20'") try to remove the dot Last edited: May 16, 2017 Upvote 0
B4X: Expand Collapse Copy MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-16' WHERE `promet`.`ime` = " &vime& " AND `promet`.`datum` = '2017-05-20'") try to remove the dot
S Samo Member Licensed User Longtime User May 16, 2017 #3 Not working. " &vime& " also without the dot. Upvote 0
R ronell Well-Known Member Licensed User Longtime User May 16, 2017 #4 did you remove the last quotation mark? i edit the code sample at post #2 .. try it again Upvote 0
DonManfred Expert Licensed User Longtime User May 16, 2017 #5 Samo said: =" .vime. " Click to expand... B4A is not PHP. If you want to concenate strings you should use & or better directly use the Smart String Literal. Upvote 0
Samo said: =" .vime. " Click to expand... B4A is not PHP. If you want to concenate strings you should use & or better directly use the Smart String Literal.
S Samo Member Licensed User Longtime User May 16, 2017 #6 Yes i remove it. B4X: Expand Collapse Copy MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-21' WHERE `promet`.`ime` =" &vime& "AND `promet`.`datum` = '2017-05-20'") Upvote 0
Yes i remove it. B4X: Expand Collapse Copy MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-21' WHERE `promet`.`ime` =" &vime& "AND `promet`.`datum` = '2017-05-20'")
R ronell Well-Known Member Licensed User Longtime User May 16, 2017 #7 B4X: Expand Collapse Copy &vime& " AND ` put spacing after vime edit: also add apostrophe B4X: Expand Collapse Copy `ime` ='" &vime& "' AND `promet` Last edited: May 16, 2017 Upvote 0
B4X: Expand Collapse Copy &vime& " AND ` put spacing after vime edit: also add apostrophe B4X: Expand Collapse Copy `ime` ='" &vime& "' AND `promet`
DonManfred Expert Licensed User Longtime User May 16, 2017 #8 ronell said: put spacing after vime Click to expand... exactly put a space BEFORE the AND Upvote 0
R ronell Well-Known Member Licensed User Longtime User May 16, 2017 #9 use logs to see the result .. if you didnt put space before the AND the result will be = JON DOEAND B4X: Expand Collapse Copy dim vime as string vime ="JON DOE" dim query as string query = "UPDATE `promet` SET `datum` = '2017-01-16' WHERE `promet`.`ime` = " &vime& " AND `promet`.`datum` = '2017-05-20'" log(query) Upvote 0
use logs to see the result .. if you didnt put space before the AND the result will be = JON DOEAND B4X: Expand Collapse Copy dim vime as string vime ="JON DOE" dim query as string query = "UPDATE `promet` SET `datum` = '2017-01-16' WHERE `promet`.`ime` = " &vime& " AND `promet`.`datum` = '2017-05-20'" log(query)
S Samo Member Licensed User Longtime User May 16, 2017 #10 Same result - grrrrrr B4X: Expand Collapse Copy MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-23' WHERE `promet`.`ime` ='" &vime& "' AND `promet`.`datum` = '2017-05-20'") B4X: Expand Collapse Copy MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-23' WHERE `promet`.`ime` =" &vime& " AND `promet`.`datum` = '2017-05-20'") Upvote 0
Same result - grrrrrr B4X: Expand Collapse Copy MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-23' WHERE `promet`.`ime` ='" &vime& "' AND `promet`.`datum` = '2017-05-20'") B4X: Expand Collapse Copy MySQLConnection.AddNonQueryToBatch ("UPDATE `promet` SET `datum` = '2017-01-23' WHERE `promet`.`ime` =" &vime& " AND `promet`.`datum` = '2017-05-20'")
R ronell Well-Known Member Licensed User Longtime User May 16, 2017 #11 what is the error? any error message, or error log Upvote 0
S Samo Member Licensed User Longtime User May 16, 2017 #12 Sorry - where i can find this log? I newer used logs before. Upvote 0
R ronell Well-Known Member Licensed User Longtime User May 16, 2017 #13 add this line when using release to access logs B4X: Expand Collapse Copy #bridgelogger: true Last edited: May 16, 2017 Upvote 0
A afields Member Licensed User Longtime User May 16, 2017 #14 Hello. In what i know if you would use directly in Heidi (which is a query tool for databases) you would write: UPDATE promet SET datum = '2017-01-16' WHERE ime = vime AND datum` = '2017-05-20' for that i assume that: i've got a table whose name is promet; that that table has fields datum ( which is a string), and ime (which is the variable) so ( i do not have that library ) but it seem to me that you would write: "update promet set datum='2017-01-16' where ime=".vime." and datum='2017-05-20'" Upvote 0
Hello. In what i know if you would use directly in Heidi (which is a query tool for databases) you would write: UPDATE promet SET datum = '2017-01-16' WHERE ime = vime AND datum` = '2017-05-20' for that i assume that: i've got a table whose name is promet; that that table has fields datum ( which is a string), and ime (which is the variable) so ( i do not have that library ) but it seem to me that you would write: "update promet set datum='2017-01-16' where ime=".vime." and datum='2017-05-20'"
R ronell Well-Known Member Licensed User Longtime User May 16, 2017 #15 afields said: "update promet set datum='2017-01-16' where ime=".vime." and datum='2017-05-20'" Click to expand... that has nothing to do with b4a, DonManfred said: B4A is not PHP. If you want to concenate strings you should use & or better directly use the Smart String Literal. Click to expand... Upvote 0
afields said: "update promet set datum='2017-01-16' where ime=".vime." and datum='2017-05-20'" Click to expand... that has nothing to do with b4a, DonManfred said: B4A is not PHP. If you want to concenate strings you should use & or better directly use the Smart String Literal. Click to expand...
A afields Member Licensed User Longtime User May 16, 2017 #16 thanks ronell! update promet set datum='2017-01-16' where ime="& vime &" and datum='2017-05-20'" Upvote 0