Solved

auto-generated primary key in sql 6.5

Posted on 1998-07-31
2
173 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

815 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now