Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

auto-generated primary key in sql 6.5

Posted on 1998-07-31
2
Medium Priority
?
204 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

618 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