Delete Query??

Results 1 to 2 of 2

Thread: Delete Query??

  1. #1
    Join Date
    Dec 1969

    Default Delete Query??

    Hi Guys!,<BR><BR>I have 2 tables namely Users and UserType where UserType lists all possible types of users e.g. Admin, etc and Users are users with a particular usertype.<BR><BR>User Table:<BR>UserID<BR>UserTypeID<BR>UName<BR><BR>Use rType Table:<BR>UserTypeID<BR>UType<BR><BR>Data Sample: UserType<BR>1,Admin<BR><BR>Data Sample: User<BR>1,1,Test<BR><BR>Now if I wish to delete the UserType Admin, is it possible for it to validate if the any data within the table users has the UserTypeID and hence if I delete Admin, I would delete the Users with the UserTypeID as well.<BR><BR>How can I do so? Validate and delete both - UserType and Dependent User.<BR><BR>Thanks!!

  2. #2
    Join Date
    Dec 1969

    Default RE: Delete Query??

    Here is how I do it, may be a better way, but works well for me...<BR>Dim strDeleteSQLUsers, strDeleteSQLAdmins<BR>strDeleteSQLAdmin = "DELETE FROM tblAdmin WHERE AdminId = "your id" "<BR>strDeleteSQLUser = "DELETE FROM tblUsers WHERE AdminId = "your id" "<BR>then.......<BR>objConn.Execute(strDeleteSQLAd min) &#039;where objConn is your conn.<BR>objConn.Execute(strDeleteSQLUsers) &#039;where objConn is your conn.<BR>This will delete the admin record from admin, then delete any users who have this adminId. Make sense?<BR>Hope this helps<BR>David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts