Grid.Blazor icon indicating copy to clipboard operation
Grid.Blazor copied to clipboard

Not working with sample northwind db from microsoft in sql express

Open swiftinitdotcom opened this issue 3 years ago • 3 comments

This looks great but Not working with sample northwind db from microsoft in sql express. Do I have to download special northwind db from this link?

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

swiftinitdotcom avatar Mar 13 '21 06:03 swiftinitdotcom

https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/northwind-pubs

swiftinitdotcom avatar Mar 13 '21 06:03 swiftinitdotcom

You can download the database from https://github.com/gustavnavar/Grid.Blazor/blob/master/GridMvc.Demo/App_Data

gustavnavar avatar Mar 14 '21 20:03 gustavnavar

Alternatively, if you prefer to install a fresh version of the database you can perform the following steps:

  • run this script from Microsoft web to create a new database: https://github.com/microsoft/sql-server-samples/blob/master/samples/databases/northwind-pubs/instnwnd.sql
  • add a column to the Customers table with the name IsVip of type bit (NOT NULL) and default value 0:
    USE Northwind;
    ALTER TABLE dbo.Customers ADD IsVip bit NOT NULL DEFAULT 0 WITH VALUES;
    GO
    
  • change manually some values of the new IsVip column to True
  • review the datetime columns. Any mismatch between EF Core model and database definitions will produce an exception and filtering will not work as expected. If database columns are defined as datetime you must modify the NorthwindDbContext class including:
    modelBuilder.Entity<Order>().Property(r => r.OrderDate).HasColumnType("datetime");
    
    for each datetime column. Or you can change all database columns' type to datetime2(7).

gustavnavar avatar Mar 14 '21 20:03 gustavnavar