Solved

auto-generated primary key in sql 6.5

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

717 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