Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing the datacolumn
Message
De
09/07/2003 07:06:43
 
 
À
09/07/2003 06:35:19
Larry Santos
Local Data System
Philippines
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00808383
Message ID:
00808394
Vues:
11
Nothing special:
1. Make sure ID column is defined as primary key for the table;
2. Set ID column to be autoincrement;
3. Try to use typed dataset. To this end drag table onto form. This will create SqlConnection and SqlDataAdapter. Right-click SqlDataAdapter and choose "Generate DataSet..." option;
4. Do not allow users to modify contents of this column. DataSet and SqlDataAdapter will automatically handles inserts, updates and deletes.
5. If you need to get autoinserted value (for example, to insert it into foreign key field), to your INSERT statement add SELECT @@IDENTITY, i.e.:
INSERT INTO (...) VALUES (...); SELECT @@IDENTITY
Run this as sigle CommandText with ExecuteScalar() method of the SqlCommand object.

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform