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
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
Post a Comment