c# - how to make combobox to take data by selection and custom also both -


i want insert data access database combobox have item in time when want insert thing there not exist in combobox how can write down manually on combobox , insert db

enter image description here

oledbcommand cmd = new oledbcommand(); cmd.commandtype = commandtype.text; cmd.commandtext = "insert [data] ( [description] ) values ('" + combobox10text + "' )"; cmd.connection = con; con.open(); cmd.executenonquery(); system.windows.forms.messagebox.show("data inserted successfully"); 

you there, dot missing. combobox10.text give entered text:

cmd.commandtext = "insert [data] ( [description] ) values ('" + combobox10.text + "' )"; 

i suggest check emptiness , use parameterized sql commands avoid sql injection


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -