database - syntax error in c#.net -


i write code extract data textbox database when goes cmd.executenonquery(); code, shows incorrect syntax near '-'. error .

this code write :

private void picturebox1_click(object sender, eventargs e) {     sqlconnection con = new sqlconnection();     string str = "server=localhost;database=ord-95;integrated security=true";     con.connectionstring = str;      //sqldataadapter da = new sqldataadapter();      sqlcommand cmd = new sqlcommand();     cmd.connection = con;         //dataset ds = new dataset();      cmd.commandtext = " insert build-seller" +           "(name-build, name-seller, family-seller)" +         "values(@name-build, @name-seller, @family-seller)";       cmd.parameters.addwithvalue("@name-build",txtbuild.text);       cmd.parameters.addwithvalue("@name-seller",txtname.text);        cmd.parameters.addwithvalue("@family-seller",txtfamily.text);         con.open();      cmd.executenonquery();      con.close();           txtamount.text = "";     txtbuild.text = "";     txtfamily.text = "";     txtname.text = "";     txtobject.text = "";     txtshop.text = "";     messagebox.show("success !", "msg",         messageboxbuttons.ok, messageboxicon.information); } 

what dbms using? need delimit column names contain - in them whatever used particular dmbs flavor...

sql server uses [ , ], select statement be:

select [column-a], [column-b] [table-1]; 

oracle uses ", select statement be:

select "column-a", "column-b" "table-1"; 

mysql uses back-ticks `, select statement be:

select `column-a`, `column-b` `table-1`; 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -