Insert Record and Retrieve Autonumber for MS Access and SQL Server: FAQs

Q: I'm trying to use the server behavior with the Check New Username behavior but it is not working. Is there anything I can do?

A: Unfortunately, the problem lies in the Check Username server behavior. If you want to hack that file, you can make it work with my extension or other insert extensions. Find this file (make a backup of it just in case something goes wrong):

c:\Program Files\Macromedia\Dreamweaver MX 2004\Configuration\ServerBehaviors\Shared\Check New Username.js

(may be in a different location in your computer)

In that file, find this code (there will be 4 instances of it):

var insertSBs = dwscripts.getServerBehaviorsByFileName("Insert Record.htm");

Insert these two lines below that line in all 4 places:

var temp = getSBs("InsertRetrieveID.htm,Insert-Retrieve Identifier.htm");
for(var i=0; i < temp.length; i++) insertSBs.push(temp[i]);

Add this function to the top of the file:

function getSBs(sb) {
  var mySbs = sb.split(",");
  var ssRecs, i;
  var sbs = new Array();

  for(var j=0; j<mySbs.length; j++) {
    ssRecs = dw.serverBehaviorInspector.getServerBehaviors();
    for (i=0; i < ssRecs.length; i++) {
      if (ssRecs[i].serverBehavior == mySbs[j]) {
        sbs.push(ssRecs[i]);
      }
    }
  }
  return sbs;
}

After applying the Check New Username behavior to the page, change the MM_insert variable to TM_insert.

That should be all you need to do. Let me know if you have problems, and make a backup of the original file just in case.

Tom

This Server Behavior works in the following server models:

  • ASP VBscript only

 

Buy Now for $12 US -- get both Access and SQL Server versions for Dreamweaver MX.

UltraDev version available here (free) for Access only.

Tom Muck
tommuck@basic-drumbeat.com

Tom Muck

www.dwteam.com

 

 

Copyright © 2002, DWTeam.com. All Rights Reserved.