types - How I can Delete a row in Access with its ID number(autonumber)? in C# -


coulmn count autonumber want delete row "where(table1.count)='" + count1 + "'"; dont know should type of count1 !!! when use "where(table1.count)=9"; dont have problem & row id numbr 9 deleted id number changeable!!! full code is

int count1 = convert.toint32(textbox2.text);         oledbcommand myoledbcomm2 = new oledbcommand();         objconn2.open();         myoledbcomm2.commandtext =             myoledbcomm2.commandtext =             "delete table1 " +             "where(table1.count)='" + count1 + "'";         myoledbcomm2.connection = objconn2;         myoledbcomm2.executenonquery();         objconn2.close(); 

you should keep type whatever type of id column in database.

though in case here if want use count1 in query can keep string/int. see problem in query. should

"delete table1 where(table1.count)=" + count1; //note have removed single quotes 

unless id column string in database.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -