Click here to Skip to main content
15,923,789 members
Home / Discussions / C#
   

C#

 
AnswerRe: autonumber Pin
Kuldeep Antil20-Sep-07 0:17
Kuldeep Antil20-Sep-07 0:17 
AnswerRe: autonumber Pin
Pete O'Hanlon20-Sep-07 0:20
mvePete O'Hanlon20-Sep-07 0:20 
Well - first of all, the database must support an autoincrement. Then, you need to get this value back. If it's SQL Server, then you are in luck because you can use the Scope_Identity in the same command to retrieve the value just inserted. Ideally, you would do this in a stored procedure. For instance:
CREATE PROCEDURE [dbo].[SaveData]
@ID INT OUT,
@Name NVARCHAR(50)
AS
SET NOCOUNT ON

INSERT INTO MyTable (Name) VALUES (@Name)

SET @ID = Scope_Identity()
To retrieve the information, you would use a SQL Command and add the @ID and @Name parameters yourself. The OutputDirection of @ID would be InputOutput, which allows you to retrieve the incremented value from @ID.

Deja View - the feeling that you've seen this post before.

Questionbyte array conversion Pin
bttds19-Sep-07 23:38
bttds19-Sep-07 23:38 
AnswerRe: byte array conversion Pin
Guffa20-Sep-07 2:38
Guffa20-Sep-07 2:38 
GeneralRe: byte array conversion Pin
bttds20-Sep-07 15:47
bttds20-Sep-07 15:47 
AnswerRe: byte array conversion Pin
Guffa21-Sep-07 10:03
Guffa21-Sep-07 10:03 
QuestionHash Table Problem Urgent Pin
Nishad8519-Sep-07 23:21
Nishad8519-Sep-07 23:21 
AnswerRe: Hash Table Problem Urgent Pin
Pete O'Hanlon19-Sep-07 23:41
mvePete O'Hanlon19-Sep-07 23:41 
AnswerRe: Hash Table Problem Urgent Pin
lost in transition 20-Sep-07 11:27
lost in transition 20-Sep-07 11:27 
Questionurgent copy image from hard Drive on local host Pin
mavii19-Sep-07 22:56
mavii19-Sep-07 22:56 
AnswerRe: urgent copy image from hard Drive on local host Pin
Giorgi Dalakishvili19-Sep-07 23:21
mentorGiorgi Dalakishvili19-Sep-07 23:21 
GeneralRe: urgent copy image from hard Drive on local host Pin
mavii19-Sep-07 23:51
mavii19-Sep-07 23:51 
GeneralRe: urgent copy image from hard Drive on local host Pin
Pete O'Hanlon19-Sep-07 23:55
mvePete O'Hanlon19-Sep-07 23:55 
GeneralRe: urgent copy image from hard Drive on local host Pin
mavii20-Sep-07 0:35
mavii20-Sep-07 0:35 
GeneralRe: urgent copy image from hard Drive on local host Pin
pmarfleet20-Sep-07 1:13
pmarfleet20-Sep-07 1:13 
GeneralRe: urgent copy image from hard Drive on local host Pin
Pete O'Hanlon20-Sep-07 1:20
mvePete O'Hanlon20-Sep-07 1:20 
GeneralRe: urgent copy image from hard Drive on local host Pin
mavii21-Sep-07 1:01
mavii21-Sep-07 1:01 
AnswerRe: urgent copy image from hard Drive on local host Pin
Malcolm Smart20-Sep-07 1:38
Malcolm Smart20-Sep-07 1:38 
Questionc++ equivalent of c# code Pin
tasumisra19-Sep-07 22:40
tasumisra19-Sep-07 22:40 
AnswerRe: c++ equivalent of c# code Pin
Christian Graus20-Sep-07 0:21
protectorChristian Graus20-Sep-07 0:21 
QuestionDo a check in a textBox Pin
lourensG19-Sep-07 22:13
lourensG19-Sep-07 22:13 
AnswerRe: Do a check in a textBox Pin
Giorgi Dalakishvili19-Sep-07 22:22
mentorGiorgi Dalakishvili19-Sep-07 22:22 
AnswerRe: Do a check in a textBox Pin
Martin#19-Sep-07 22:35
Martin#19-Sep-07 22:35 
AnswerRe: Do a check in a textBox Pin
Nouman Bhatti19-Sep-07 23:50
Nouman Bhatti19-Sep-07 23:50 
GeneralRe: Do a check in a textBox Pin
Martin#19-Sep-07 23:55
Martin#19-Sep-07 23:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.