473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can someone explain this code for me pls!

markmcgookin
648 Expert 512MB
Hi Folks,

this may seem very lazy, but can someone exaplin this bit of code for me?

regID int IDENTITY(0,1)

It is part of an SQL CE command in a VB app, but I just don't get what the regID in IDENTITY (0,1) is in there for.

the full code is

Expand|Select|Wrap|Line Numbers
  1.  'Create SQL command to create the tblDetails table
  2.  
  3. Dim cmdTabla As New SqlCeCommand("CREATE TABLE tblDetails(regID int IDENTITY(0,1) PRIMARY KEY, Flower_ID NTEXT, Name_Eng NTEXT, Name_Lat NTEXT, Location_ID NTEXT, Habitat_ID NTEXT, Season_ID NTEXT, Family_ID NTEXT, Size NTEXT, Description NTEXT)", conn)
  4.  
  5.  
Sorry I havent trimmed the code for the window, don't really think it matters here.
Feb 26 '07 #1
5 1520
willakawill
1,646 1GB
Hi. This statement is using CREATE TABLE and refers to one of the columns in the new table, tblDetails
regID int IDENTITY(0,1)

regID is the name of the column
int is the data type
IDENTITY means this is an autonumber or auto-increment field
(0,1) the zero is the seed or starting number. The one is the increment, i.e. each new record will increment by one.
Feb 26 '07 #2
markmcgookin
648 Expert 512MB
regID is the name of the column
int is the data type
IDENTITY means this is an autonumber or auto-increment field
(0,1) the zero is the seed or starting number. The one is the increment, i.e. each new record will increment by one.
Hi, I understand the create etc.. However when I open the table in SQL Server CE the Reg "column" that it appears the code creates does not appear as a standard column, I created multiple tables and from what I gather the

CREATE TABLE **TABLENAME** (regID int IDENTITY(0,1) stays the same for each one. However it seems to produce different values for the Identity/reg in SQL viewer.

I am not even sure if this is important to my system design, I just like to understand all my code, and don't see why I am including this. Just wanted to know why it was there.
Feb 27 '07 #3
willakawill
1,646 1GB
An identity column is not a standard column. You cannot update it. It is controlled by the database.
Feb 27 '07 #4
markmcgookin
648 Expert 512MB
An identity column is not a standard column. You cannot update it. It is controlled by the database.
Ah so is it just one of those things thats there that you shouldn't ask about? It works .. so don't touch?
Feb 27 '07 #5
Killer42
8,435 Expert 8TB
Ah so is it just one of those things thats there that you shouldn't ask about? It works .. so don't touch?
Not at all. You should understand the tools you're working with. It's just that in this case you are defining a field with parameters that indicate the database software should provide the values automatically, so you cannot update the field.
Feb 27 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: J Allen Horner | last post by:
I'm just starting to learn C, and the tutorial I'm reading uses this code as an example: ----------- #include <stdio.h> #define MAX 10 int a; int rand_seed=10;
21
by: MLH | last post by:
A97 procedure to open http://www.arch.com/message/ enter an 800 number, press "Continue", enter a text msg string from a memo field and press "Send" This is a calendaring and appointment A97...
0
by: naheed javaid | last post by:
I m student and doing my final project. My project is related to screen capturing. my project captures screen and save the captured screen as bitmaps in a folder. while the screen recording audio...
2
by: hassruby | last post by:
Can someone pls help me with some validation that im having a few technical problems with in my program. First of all, I will explain to you a little about what my program is suppose to do. It...
0
by: sathyakvani | last post by:
hi al i wrote a code (LOgin form) that checks the user id and if it exists validates the password but this is not all validating and simply displaying user does not exist i am sending the code...
4
by: Ravi | last post by:
#define JOIN(s1,s2) printf("%s = %s %s = %s",#s1,s1,#s2,s2)
2
by: parvtb | last post by:
Thanks for your patience to read the entire post to understand my confusion I have the user-defined class "tools": class tools{ public: tools( ......) {} friend bool operator<...
6
by: Dave Young | last post by:
I'm looking at some code that i've inherited and I'm not really familar with what's going on here and was hoping somone could explain it to me. For reference: f1 is a long f2 is a long ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.