HELLO! I've been debugging my code for an hour now. seriously.
So I have this string:

 SQLString = "UPDATE `etmsystem`.`main` SET `timeIn` = '22:00' WHERE `main`.`serialNo` = '70002B4A8F9E'"

actually the TIME and the SERIAL NO. here is to be represented by a variable. But I changed the code into that to see that there is something weird happening.

Here are the steps that I've done:
1. search the web. --- done.
2. remove the `
3. remove the etmsystem (database name) and remove the main/
4. check for whitespaces.

when I run the code in localhost phpmyadmin, it actually works.
but in VB.net...no.
by the way, serialNo column in my database is a VARCHAR which has 12 length.

I've been making programs with mySQL connection ever since I learned VB.net (last two years) hehe.
Other sqlstrings are working in my program, like:

serverFrm.SQLString = "DELETE FROM main WHERE serialNo = " + serverFrm.toDelete.ToString + ";"

                serverFrm.SQLCommand = New MySqlCommand(serverFrm.SQLString, serverFrm.SQLConnection)
                serverFrm.SQLDataReader = serverFrm.SQLCommand.ExecuteReader()

ps: error is
You have an error in your SQL syntax; check the manual that corresponds.......to use near 'serialNo = 70002B27ffawfaw' at line 1
for me it is weird, really. but I know I just can't see a very small mistake here.

I'm glad I've finally solved this problem :(
solution: I copied the DELETE FROM main..... code and then tried to execute it in the place where the problem occurs and then edit the table/variable one by one and run the program!

VB.net really doesn't care for the `````````
thing in the SQL strings.

my final sqlstring is:

SQLString = "UPDATE main SET timeIn = '" + currentTime + "' WHERE serialNo = '" + serialNo.ToString + "';"

But I don't know yet what caused the error.
I can't delete this article so I'm gonna post my solution and mark this question solved.

A whole hour? That's nothing ;) But seriously, good on you for soliving the problem yourself and posting the solution for others.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.