locked
command builder problem IN delete- please help!! RRS feed

  • Question

  • User-58406577 posted

    Hi all

    I have a small project in c# and ms-access I use query builder to manage my tables in ms-access.

     the problem is, select qeury works great, update query works great, delete doesn't work , and there is no error msg!!!!!!

     please help!!

    Monday, November 30, 2009 11:11 AM

Answers

  • User-1199946673 posted

     

    in query builder, I don't need to write the sql code . update works nd so as insert. any idea how to help me?

     

    Read this

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 30, 2009 1:31 PM

All replies

  • User-126244515 posted

    Can you show us the code, please? 

    Monday, November 30, 2009 12:13 PM
  • User-58406577 posted

    using (cn)

    {

    OleDbDataAdapter adapter = new OleDbDataAdapter();

    string queryString = "SELECT [a],[b] FROM [table]";

    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _conStrName + ";User Id=admin;Password=;";

    OleDbConnection connection = new OleDbConnection(cn.ConnectionString);

    adapter.SelectCommand = new OleDbCommand(queryString, connection);

    OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);

     

    adapter.SelectCommand.CommandText = queryString;

    adapter.DeleteCommand = builder.GetDeleteCommand();

    adapter.Update(DATATABLE);

    return ds;

    Monday, November 30, 2009 12:34 PM
  • User-126244515 posted

    Right, I don't see how and where you try to delete a row? The code looks somewhat incomplete, did you mix two blocks of code, or...?

    Monday, November 30, 2009 12:41 PM
  • User-58406577 posted

     

    in query builder, I don't need to write the sql code . update works nd so as insert. any idea how to help me?

    Monday, November 30, 2009 12:56 PM
  • User-1199946673 posted

     

    in query builder, I don't need to write the sql code . update works nd so as insert. any idea how to help me?

     

    Read this

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 30, 2009 1:31 PM