c# - Error in creating a table in mySQL -


i tried of suggestions still same error. have error in sql syntax; check manual corresponds mysql server version right syntax use near ''' (size int(5))' @ line 1

here code:

            try{             query = "create table @name (size int(5))";             mysqlcommand cmd = new mysqlcommand(query, con);               cmd.parameters.add("@name", mysqldbtype.varchar, 30).value = txtboxname.text;              con.open();             cmd.executenonquery();             con.close();             }             catch (exception)         {             throw;         }                 {             if (con.state == connectionstate.open)             {                 con.close();             }         } 

i think intended use backticks `` escape table name used single quotes instead.

  query = "create table `"+ txtboxname.text + "`(size int(5))"; 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -