Click here to Skip to main content
15,921,990 members
Home / Discussions / C#
   

C#

 
Questionhow to maintain the same order in a treeview control where the nodes comes from other treeview. [modified] Pin
Gonxh Aniket3-Feb-09 17:41
Gonxh Aniket3-Feb-09 17:41 
AnswerRe: how to maintain the same order in a treeview control where the nodes comes from other treeview. Pin
MartyExodus3-Feb-09 19:18
MartyExodus3-Feb-09 19:18 
QuestionAudio Input Class? Pin
MartyExodus3-Feb-09 17:03
MartyExodus3-Feb-09 17:03 
AnswerRe: Audio Input Class? Pin
Christian Graus3-Feb-09 17:44
protectorChristian Graus3-Feb-09 17:44 
GeneralRe: Audio Input Class? Pin
MartyExodus3-Feb-09 17:52
MartyExodus3-Feb-09 17:52 
GeneralRe: Audio Input Class? Pin
Christian Graus3-Feb-09 19:21
protectorChristian Graus3-Feb-09 19:21 
GeneralRe: Audio Input Class? Pin
MartyExodus6-Feb-09 13:42
MartyExodus6-Feb-09 13:42 
QuestionThreading? Pin
benjamin yap3-Feb-09 15:50
benjamin yap3-Feb-09 15:50 
AnswerRe: Threading? Pin
Ennis Ray Lynch, Jr.3-Feb-09 15:58
Ennis Ray Lynch, Jr.3-Feb-09 15:58 
GeneralRe: Threading? Pin
benjamin yap3-Feb-09 16:16
benjamin yap3-Feb-09 16:16 
GeneralRe: Threading? Pin
Ennis Ray Lynch, Jr.3-Feb-09 16:21
Ennis Ray Lynch, Jr.3-Feb-09 16:21 
GeneralRe: Threading? Pin
benjamin yap3-Feb-09 16:26
benjamin yap3-Feb-09 16:26 
GeneralRe: Threading? Pin
Ennis Ray Lynch, Jr.3-Feb-09 16:55
Ennis Ray Lynch, Jr.3-Feb-09 16:55 
QuestionC# ID Generator... Pin
Illegal Operation3-Feb-09 14:27
Illegal Operation3-Feb-09 14:27 
AnswerRe: C# ID Generator... Pin
Ennis Ray Lynch, Jr.3-Feb-09 14:59
Ennis Ray Lynch, Jr.3-Feb-09 14:59 
AnswerRe: C# ID Generator... Pin
Expert Coming3-Feb-09 16:43
Expert Coming3-Feb-09 16:43 
GeneralRe: C# ID Generator... Pin
fazal201019-Sep-09 18:34
fazal201019-Sep-09 18:34 
AnswerRe: C# ID Generator... Pin
_Maxxx_3-Feb-09 18:52
professional_Maxxx_3-Feb-09 18:52 
Are you saying you want to stop SQL auto incrementing and instead do it yourself? Or, are you saying that you just want to find out what the ID of the previously inserted record was?

If the former, you need to be careful - as if multiple users access the db while you are doing your 'next number' calculation, t may end up trying to insert a duplicate value - much better to let SQL handle that for you.

To get the value of the last inserted identiy, use the SQL function SCOPE_IDENITY(). e.g.
Insert into Person (PersonId, Person) values (@PersonId, @Person);
Select SCOPE_IDENTITY();

then use

int newId = Convert.ToInt32(db.ExecuteScalar(dbCommand));

which will give your program back the ID just inserted.(I'm guessing here that your table has an Id column which is auto-incremented, and a PersonId column which is created somehow else.

(on re-reading this

Illegal Operation wrote:
incriment it by 1 when inserting the PersonId.


I'm not sure what you mean by 'inserting the PersonId'?

___________________________________________
.\\axxx
(That's an 'M')

AnswerRe: C# ID Generator... Pin
raghsingh3-Feb-09 23:32
raghsingh3-Feb-09 23:32 
AnswerRe: C# ID Generator... Pin
Wendelius4-Feb-09 8:13
mentorWendelius4-Feb-09 8:13 
QuestionWeb query in c# Pin
bfis1081373-Feb-09 12:57
bfis1081373-Feb-09 12:57 
AnswerRe: Web query in c# Pin
Guffa3-Feb-09 13:08
Guffa3-Feb-09 13:08 
QuestionGsm Redialing Problem Pin
ajorge20083-Feb-09 11:22
ajorge20083-Feb-09 11:22 
QuestionWPF is easy to learn? Pin
Seraph_summer3-Feb-09 9:50
Seraph_summer3-Feb-09 9:50 
AnswerRe: WPF is easy to learn? Pin
Guffa3-Feb-09 10:29
Guffa3-Feb-09 10:29 

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.