Click here to Skip to main content
15,608,553 members
Home / Discussions / Database
   

Database

 
PinnedHOW TO ANSWER A QUESTION Pin
Chris Maunder16-Jul-09 3:10
cofounderChris Maunder16-Jul-09 3:10 
PinnedHow to get an answer to your question Pin
Chris Maunder10-Nov-05 16:30
cofounderChris Maunder10-Nov-05 16:30 
QuestionTSQL, Order by case, and I need to order by version Pin
jkirkerx21-Mar-23 8:09
professionaljkirkerx21-Mar-23 8:09 
AnswerRe: TSQL, Order by case, and I need to order by version Pin
Ron Nicholson21-Mar-23 8:22
professionalRon Nicholson21-Mar-23 8:22 
GeneralRe: TSQL, Order by case, and I need to order by version, [fixed] good enough for me, thanks Pin
jkirkerx21-Mar-23 8:36
professionaljkirkerx21-Mar-23 8:36 
GeneralRe: TSQL, Order by case, and I need to order by version, [fixed] good enough for me, thanks Pin
Mycroft Holmes21-Mar-23 12:23
professionalMycroft Holmes21-Mar-23 12:23 
GeneralRe: TSQL, Order by case, and I need to order by version, [fixed] good enough for me, thanks Pin
jkirkerx23hrs 40mins ago
professionaljkirkerx23hrs 40mins ago 
GeneralRe: TSQL, Order by case, and I need to order by version, [fixed] good enough for me, thanks Pin
jsc4212hrs 40mins ago
professionaljsc4212hrs 40mins ago 
GeneralRe: TSQL, Order by case, and I need to order by version, [fixed] good enough for me, thanks Pin
jkirkerx6hrs 15mins ago
professionaljkirkerx6hrs 15mins ago 
GeneralRe: TSQL, Order by case, and I need to order by version Pin
jkirkerx21-Mar-23 8:46
professionaljkirkerx21-Mar-23 8:46 
GeneralRe: TSQL, Order by case, and I need to order by version Pin
Ron Nicholson21-Mar-23 11:17
professionalRon Nicholson21-Mar-23 11:17 
QuestionSQL where clause variability up against coding standards Pin
Brian L Hughes10-Mar-23 15:59
Brian L Hughes10-Mar-23 15:59 
AnswerRe: SQL where clause variability up against coding standards Pin
Dave Kreskowiak11-Mar-23 5:37
mveDave Kreskowiak11-Mar-23 5:37 
AnswerRe: SQL where clause variability up against coding standards Pin
Eddy Vluggen11-Mar-23 9:00
professionalEddy Vluggen11-Mar-23 9:00 
AnswerRe: SQL where clause variability up against coding standards Pin
jschell13-Mar-23 6:56
jschell13-Mar-23 6:56 
QuestionCode: 1292 SQL State: 22007 --- Incorrect datetime value Pin
Siavash.BRY6-Mar-23 20:56
Siavash.BRY6-Mar-23 20:56 
AnswerRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value Pin
Richard MacCutchan6-Mar-23 21:26
mveRichard MacCutchan6-Mar-23 21:26 
GeneralRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value Pin
Siavash.BRY6-Mar-23 21:52
Siavash.BRY6-Mar-23 21:52 
GeneralRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value PinPopular
Richard MacCutchan6-Mar-23 22:09
mveRichard MacCutchan6-Mar-23 22:09 
AnswerRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value Pin
jschell8-Mar-23 7:03
jschell8-Mar-23 7:03 
AnswerRe: Code: 1292 SQL State: 22007 --- Incorrect datetime value Pin
RedDk8-Mar-23 8:30
RedDk8-Mar-23 8:30 
QuestionEF Core 6 Question Pin
Kevin Marois1-Feb-23 16:24
professionalKevin Marois1-Feb-23 16:24 
Is it possible to insert default data in a table that was created by Entity Framework?
Here's my DBContext
public class SqlDataContext : DbContext
{
    private string _connectionString = "";

    public DbSet<UserEntity> Users { get; set; }

    public SqlDataContext()
    {
        // This will be moved to the controller later on
        _connectionString = @"Server=MAROIS_KEVIN_1\SQLEXPRESS;Database=Test1;Trusted_Connection=true;Encrypt=false;";
    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer(_connectionString, options => options.EnableRetryOnFailure());
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<UserEntity>(entity =>
        {
            /* Users */
            entity.ToTable("Users", "dbo");

            entity.HasKey(e => e.UserId)
                    .HasName("PrimaryKey_UserId");
        });
    }
}
I would like to insert a default user into the User's table each time I create the database.

Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: EF Core 6 Question Pin
Dave Kreskowiak2-Feb-23 2:34
mveDave Kreskowiak2-Feb-23 2:34 
GeneralRe: EF Core 6 Question Pin
Kevin Marois2-Feb-23 5:45
professionalKevin Marois2-Feb-23 5:45 
Questionexecute an update  using --> "Exec sp_executesql @Sql1" Pin
Member 115338921-Feb-23 4:55
Member 115338921-Feb-23 4: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.