I want to update some record in access data base, but the update command is
not updating the table...
Insertiion is working fine.. the code is:

com = new OleDbCommand("UPDATE ServerAuthorisation SET Permissions=@permission WHERE UserName=@user_name", conn);
conn.Open();
if (conn.State == ConnectionState.Open)
  {
      com.Parameters.Add("@user_name", OleDbType.Char, 100);
      com.Parameters.Add("@permission", OleDbType.Char, 100);

       com.Parameters["@user_name"].Value = user_name;
    com.Parameters["@permission"].Value = permission;
   }
     try
     {
      com.ExecuteNonQuery();
      conn.Close();
     }
      catch (OleDbException exe)
      {
       Console.WriteLine(exe.Message);
         Console.ReadLine();

      }

No exception is raised but the data base is not being updated... plz help...

Recommended Answers

All 2 Replies

The OLE DB.NET Framework Data Provider uses positional parameters that are marked with a question mark (?) instead of named parameters. So you'll have to replace your @... with just ? and add the parameters in the order that they should appear. Look at the Remarks on MSDN

really thanks alot... It works perfect...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.