Solved

auto-generated primary key in sql 6.5

Posted on 1998-07-31
2
185 Views
Last Modified: 2010-08-05
Question :
1. How to create an auto-generated primary Key in SQL 6.5. (I notice it can be done in Access database).

2. Why 'Begin Transaction' query cannot be executed thru pass-thru command in Jet Database.
e.g : dbDatabase.Execute "Begin Transaction"  -> cause error : cannot execute query.

thansk
0
Comment
Question by:asiasoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
CesarGon earned 50 total points
ID: 1467335
1. Set the field you want to be a auto-generated primary key as "identity" field. You can do it in the Enterprise Manager.

2. You cannot execute just a "BEGIN TRAN" in a statement; you must use dbDatabase.BeginTrans or else pack the begin-update-commit/rollback in a single statement:

  Dim strSql As String
  strSql = "BEGIN TRAN" & vbCrLf
  strSql = strSql & "DELETE FROM Computers" & vbCrLf
  strSql = strSql & "COMMIT TRANS"
  dbDatabase.Execute strSql

That works!.

Regards,
César.
0
 

Author Comment

by:asiasoft
ID: 1467336
thanks Cesar
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question