Click here to Skip to main content
15,306,036 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Entity Framework : how to generate custom automatic numbers Pin
jschell29-Dec-21 7:17
Memberjschell29-Dec-21 7:17 
GeneralRe: C# Entity Framework : how to generate custom automatic numbers Pin
Gerry Schmitz29-Dec-21 15:22
mveGerry Schmitz29-Dec-21 15:22 
JokeRe: C# Entity Framework : how to generate custom automatic numbers Pin
Peter_in_278029-Dec-21 15:32
professionalPeter_in_278029-Dec-21 15:32 
GeneralRe: C# Entity Framework : how to generate custom automatic numbers Pin
Gerry Schmitz29-Dec-21 15:54
mveGerry Schmitz29-Dec-21 15:54 
GeneralRe: C# Entity Framework : how to generate custom automatic numbers Pin
jschell30-Dec-21 7:31
Memberjschell30-Dec-21 7:31 
GeneralRe: C# Entity Framework : how to generate custom automatic numbers Pin
Gerry Schmitz30-Dec-21 9:23
mveGerry Schmitz30-Dec-21 9:23 
GeneralRe: C# Entity Framework : how to generate custom automatic numbers Pin
jschell23-Jan-22 7:01
Memberjschell23-Jan-22 7:01 
GeneralRe: C# Entity Framework : how to generate custom automatic numbers Pin
Fidele Okito30-Dec-21 3:14
MemberFidele Okito30-Dec-21 3:14 
Dear jschell,

Thank you for your comment which is helpful alot.
I was thinking to create a user defined function(tsql) :
create function NextInvoiceValue()
return nvarchar(30)
Begin
declare @lastId int;
declare @valueinvoice nvarchar(30)

--update table1 set next_id = next_id + 1 where prefix_text='xxx' and table_name='fff';
select @lastId = next_id from table1 where prefix_text='xxx' and table_name='fff';
--insert into table2 (invoice_number) values('xxx' + '-' + @lastId + '-' + ...);
set @valueinvoice='xxx' + '-' + (@lastId +1) + '-' + ...;
return @valueinvoice;

end


This function will be used on create table table2 (..., invoicenum nvarchar(30) not null default dbo.NextInvoiceValue()...)

and the last step is to create a trigger(after insert) on table2, this trigger will execute the update statement :
update table1 set next_id = next_id + 1 where prefix_text='xxx' and table_name='fff';


I m wondering if this will make sense for daily traffic of 100 000 insertions

Thank you again
FO
GeneralRe: C# Entity Framework : how to generate custom automatic numbers Pin
jschell30-Dec-21 7:26
Memberjschell30-Dec-21 7:26 
GeneralRe: C# Entity Framework : how to generate custom automatic numbers Pin
Fidele Okito30-Dec-21 8:57
MemberFidele Okito30-Dec-21 8:57 
QuestionFull path Crystal report on client server in c# Pin
remiki26-Dec-21 22:54
Memberremiki26-Dec-21 22:54 
AnswerRe: Full path Crystal report on client server in c# Pin
OriginalGriff26-Dec-21 23:22
mveOriginalGriff26-Dec-21 23:22 
AnswerRe: Full path Crystal report on client server in c# Pin
remiki26-Dec-21 23:30
Memberremiki26-Dec-21 23:30 
GeneralRe: Full path Crystal report on client server in c# Pin
jschell29-Dec-21 7:25
Memberjschell29-Dec-21 7:25 
QuestionWPF Filtering DataGrid causes UI Freeze Pin
Member 1480965126-Dec-21 4:25
MemberMember 1480965126-Dec-21 4:25 
AnswerRe: WPF Filtering DataGrid causes UI Freeze Pin
Gerry Schmitz26-Dec-21 6:54
mveGerry Schmitz26-Dec-21 6:54 
AnswerRe: WPF Filtering DataGrid causes UI Freeze Pin
Mycroft Holmes26-Dec-21 11:41
professionalMycroft Holmes26-Dec-21 11:41 
QuestionWMI Connection to Remote PC with ManegementScope too slow(8-10 seconds). The WMI Query itself is OK (under 1 second) Pin
Mustafa Levrek26-Dec-21 1:47
MemberMustafa Levrek26-Dec-21 1:47 
AnswerRe: WMI Connection to Remote PC with ManegementScope too slow(8-10 seconds). The WMI Query itself is OK (under 1 second) Pin
Gerry Schmitz26-Dec-21 2:13
mveGerry Schmitz26-Dec-21 2:13 
GeneralRe: WMI Connection to Remote PC with ManegementScope too slow(8-10 seconds). The WMI Query itself is OK (under 1 second) Pin
OriginalGriff26-Dec-21 2:25
mveOriginalGriff26-Dec-21 2:25 
GeneralRe: WMI Connection to Remote PC with ManegementScope too slow(8-10 seconds). The WMI Query itself is OK (under 1 second) Pin
Mustafa Levrek26-Dec-21 2:36
MemberMustafa Levrek26-Dec-21 2:36 
GeneralRe: WMI Connection to Remote PC with ManegementScope too slow(8-10 seconds). The WMI Query itself is OK (under 1 second) Pin
Dave Kreskowiak26-Dec-21 4:42
mveDave Kreskowiak26-Dec-21 4:42 
Questionnewbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith21-Dec-21 2:23
Memberbiull smith21-Dec-21 2:23 
AnswerRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
#realJSOP21-Dec-21 2:37
mva#realJSOP21-Dec-21 2:37 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith21-Dec-21 3:04
Memberbiull smith21-Dec-21 3:04 

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.