Tuesday, March 27, 2012

Getting the identity of the most recently added record

http://www.mikesdotnetting.com/Article/54/Getting-the-identity-of-the-most-recently-added-record

SqlCommand command = new SqlCommand(SQL, Conn, Trans);
                command.Parameters.Add(new SqlParameter("@Id",SqlDbType.Int));
                command.Parameters["@Id"].Direction = ParameterDirection.Output;
               // command.Parameters["@Id"].SourceColumn = "Id";
              //  cmdInsert.Parameters.Add(new SqlParameter("@CustomerName", SqlDbType.VarChar, 50, "CustomerName"));
                command.Parameters.AddWithValue("@token", SqlDbType.VarChar).Value = account.Token;

No comments:

Post a Comment