Click to See Complete Forum and Search --> : database help ...


michelle5422
July 8th, 2003, 12:19 PM
i want to delete the particular record which is input by user . so how i write in my sql query?
CString name;
CEdit *edit1;
edit1=(CEdit*)GetDlgItem(IDC_EFNAME);
edit1->GetWindowText(name);

rs.Open( "SELECT * FROM Categories WHERE Identity="'name'"" );
rs.Delete();

but it got error at name there ....
i have out od ideal to solve it .. thanks alot ur help
:(

BlueGazoo
July 8th, 2003, 09:41 PM
What is the error message, exactly?

What CursorType and LockType are you using on the Open Command?:

e.g.:
objConnection.Open SQLStatement, strConnect, adOpenDynamic, adLockOptimistic, adCmdText

antares686
July 9th, 2003, 06:37 AM
If you do not need to save the data or review it then write a delete statement and use the execute method of the connection object to run it. This will reduce the round trips made by opening in the recordset and deleting. Also, may be better ways depending on the type of database you are running against than just a delete statement to streamline the connection chatter.