Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing the datacolumn
Message
From
09/07/2003 07:06:43
 
 
To
09/07/2003 06:35:19
Larry Santos
Local Data System
Philippines
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00808383
Message ID:
00808394
Views:
12
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?...

Previous
Reply
Map
View

Click here to load this message in the networking platform