access database row and edit one line of existing user

ok what i am trying to do to the best of my ability is create a user username and password witch is done perfectly fine

the issue i am having is once the user is registered i want to save there machine id i have the following code to do so

This is my connection string i have assigned the database file address path string connString; connString = $"SERVER={server};DATABASE={database};UID={uid};PASSWORD={password};"; string machineidfull = processorid + mbored; This is my update query in which i am taking input from the user through windows forms and update the record. string Query = "update elfenliedtopfan5_login set users(machineid='" + machineidfull + "');"; This is MySqlConnection here i have created the object and pass my connection string. MySqlConnection MyConn2 = new MySqlConnection(connString); MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); MySqlDataReader MyReader2; MyConn2.Open(); MyReader2 = MyCommand2.ExecuteReader(); MessageBox.Show("Data Updated"); while (MyReader2.Read()) { } MyConn2.Close();Connection closed here

but the issue i have is it gives me the following error

{"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(machineid='BFEBFBFF000906E9170808xxxxxxx')' at line 1"}

also i know its unrelated i think to this but is there a way to ban users as well so if the machine id is not listed as a accessed user then it will stop user using my program

thanks in advance elfenliedtopfan5

Answer Answered by Ian Gilfillan in this comment.

Your UPDATE syntax is wrong. I suggest taking a look at UPDATE as well as Adding and Changing Data in MariaDB.


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.