Giter Site home page Giter Site logo

erikej / sqlcetoolbox Goto Github PK

View Code? Open in Web Editor NEW
824.0 61.0 175.0 110.95 MB

SQLite & SQL Server Compact Toolbox extension for Visual Studio, SSMS (and stand alone)

License: Other

C# 91.85% XSLT 4.33% Batchfile 0.20% Smalltalk 1.23% CSS 0.36% JavaScript 0.16% HTML 0.51% PowerShell 0.02% TSQL 1.33%
visual-studio sql-server-compact sql-server sqlite vsix entity-framework

sqlcetoolbox's Introduction

SQLite & SQL Server Compact Toolbox

Visual Studio Marketplace Rating Visual Studio Marketplace Downloads Twitter Follow

My tools and utilities for embedded database development

Visual Studio & SSMS 17.x extension, standalone app and command line tools, for managing all aspects of your SQL Server Compact/SQLite database files' data and schema, including generation of code, database diagrams and database documentation.

If you use my free tools, I would be very grateful for a rating or review here

Documentation

Getting started guide

Known issues with workarounds

Release notes for released versions and daily builds

Command line tools

Scripting API samples

Downloads/builds

Visual Studio Extension

Release

Download the latest version of the Visual Studio extension (for both 3.5, 4.0 and SQLite) from Visual Studio MarketPlace

Or just install from Tools, Extensions and Updates in Visual Studio!

Daily build

You can download the daily build from VSIX Gallery.

You can also automatically get the latest build of the Master branch directly in Visual Studio

If you need the Visual Studio 2010 extension, please contact me, and I can provide a link!

SQL Server Management Studio (SSMS) 20 and 17 Extension

You find the extension under the View menu in SSMS.

Release

Download the latest version of the SSMS 17 extension (for both 3.5, 4.0, SQLite and SQL Server) from Visual Studio MarketPlace

Daily build

You can download the daily build of the SSMS 20 extension from VSIX Gallery

Installing the SSMS 20 extension

Sine SSMS extensions are unsupported, you will have to manually install this extension version (at least until I or someone else decides to create an installer)

From an administrator command prompt:

Create a folder called "SqlCeToolbox" under C:\Program Files (x86)\Microsoft SQL Server Management Studio 20\Common7\IDE\Extensions\

Copy the extension.vsix that you downloaded from VSIX Gallery to the new folder.

Unzip the extension.vsix to the new folder. For example: "C:\program files\7-zip\7z.exe" e extension.vsix -y

You should now have 48 files in the SqlCeToolbox folder, and the extension is "installed".

Installing the SSMS 17 extension

Use the following command line:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\vsixinstaller.exe" "full path to extension.vsix"

EF Core Power Tools for Visual Studio 2022

The EF Core Power Tools have moved to this repository

Standalone for SQL Server Compact 4.0 and 3.5 SP2

Release

You can download the latest release of the standalone tools from the Github releases here

Command line tools

Release

You can download the latest release of the command line tools from the Github releases here

How do I contribute

If you encounter a bug or have a feature request, please use the Issue Tracker

The Toolbox is open source and welcomes any contribution. There are a number of issues in the Backlog that the project needs help with!

sqlcetoolbox's People

Contributors

achimstuy avatar alexl70 avatar awseward avatar drewnoakes avatar dzholmukhanov avatar erikej avatar gsv-helbling avatar icnocop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sqlcetoolbox's Issues

revoke deletion right

I would like to protect the sdf file from users who could copy and replace by an older sdf such that transactions recorded could be removed. Howeve , it seems that full access right should be granted to everyone. Any hints?

Windows 7 and sql server compact 3.5

Thais

Problem with installing EF in Windows Phone/Windows Store project

Transferred from: https://visualstudiogallery.msdn.microsoft.com/0e313dfd-be80-4afb-b5e9-6e74d369f7a1/view/Discussions

Thank You for this usefull tool. I'm writting because I have problem which I can't resolve. I have VS Community 2015. Let me describe step by step, how I install Your tool:

  1. I didn't have EnityFramework and EntityFramework.SqlServerCompat so I installed it from Nuget.
  2. I installed Your tool
  3. I created new database. Connection is fine but then I have this red error: http://oi68.tinypic.com/2hd2l3b.jpg
  4. When I want to add entity model to project I get error:
    "Please add the EntityFramework.SqlServerCompact NuGet package to the project"

I have 2 question too.
1.Do I have to EnityFramework and EntityFramework.SqlServerCompat referenced in solution? Because I don't see any of these in References in project.

  1. May I install 3.5 version of Your tool and have option "Add Windows Phone DataContext to current Project".

Thank You,
Wojtek

SQLite standard data types.

You've asked me to post this on GitHub as an issue today after I wrote my review and mentioned that I don't see some standard SQLite data types being listed.

Here's what I mean:
testtable

SQLite has five standard data types: NULL, INTEGER, REAL, TEXT, BLOB

It has excellent type affinity support, but my workflow has been such that I got used to using the five data types I'm given by SQLite and I know which one I need to use when. I don't use other datatype representations, because I don't need to.

The list in that screenshot does not display 'text', unless it's the 'ntext'? It also does not list 'blob'. Frankly, there's no point displaying all the other datatypes, since SQLite will convert them all to one of the five available types, so in the end they're a bit pointless. nvarchar can have a limit of 10 characters and based on affinity will become a TEXT, voiding the length restriction. Everything's Unicode on top of that, so varchar or nvarchar... it doesn't matter at all in the end (unless, of course, you play with the preprocessor macros... but very few will). Now... it's a good idea, perhaps, to have them, so that individuals who don't know how their datatype should be represented by SQLite would have an option, but.... that's not up to me to decide.

Anyways, this is a very minor thing, in my opinion, and does not detract from the wonderful quality of the product.

Test connection automatically before closing "Add SQL Server Compact/SQLite Connection" dialog

Very simple issue: often I try to open an SQLCe database that is more than the default 256 MB in size, and so when I press OK, I get an error message saying the database file is too large:

image

The problem is that after I press OK on the error window, the Add Connection form disappears and I have to reopen the window and then navigate to my database again.

This is a very minor problem, but it would save people a bit of time if:

  1. the last used filename was stored somehow;
  2. if there is an error you do not close the Add Connection form; or
  3. the default Max database size in MB could just be 4091 by default (although I'm wondering if there is a reason you didn't already do this?).

Thank you for providing this tool for the community - it is excellent in every way, and after using it quite a lot for the past few years this is the only complaint I have...

Error Code: 80040E14

edit log table:

level nvarchar 10 True False 0 0

execute code:

-- Script Date: 5/8/2015 4:06:13 PM - ErikEJ.SqlCeScripting version 3.5.2.49
ALTER TABLE [log] ALTER COLUMN [level] nvarchar(10) DEFAULT '11' NOT NULL ;
GO

get message:

Error Code: 80040E14
Message : There was an error parsing the query. [ Token line number = 1,Token line offset = 53,Token in error = DEFAULT ]
Minor Err.: 25501
Source : SQL Server Compact ADO.NET Data Provider
Num. Par. : 1
Num. Par. : 53
Err. Par. : DEFAULT

comments

ErikEJ wrote May 10 at 6:51 AM

Thanks for reporting this - assume you are using the GUI to change the column?

Looks like this should be what was actually generated:

ALTER TABLE [Elmah] ALTER COLUMN [Host] nvarchar(50) NOT NULL;

ALTER TABLE [Elmah] ALTER COLUMN [Host] SET DEFAULT ('11');

Subqueries against SQLite causing VS to lock up

Running a query that contains a subquery against a SQLite database causes VS (2013 Pro) to lock up; full query below:

SELECT 
    AssetToReport, 
    HostName, 
    IpAddress, 
    GroupName, 
    FileName, 
    (SELECT 
            OperatingSystem 
        FROM 
            UniqueFinding U2 
        NATURAL JOIN Vulnerbaility 
        WHERE 
            U1.AssetToReport = U2.AssetToReport 
        AND 
            VulnId = 'SpecifiedVulnId') AS OperatingSystem 
FROM 
    UniqueFinding U1 
NATURAL JOIN FindingTypes 
NATURAL JOIN Groups 
NATURAL JOIN FileNames 
NATURAL JOIN Vulnerability 
WHERE 
    FindingType = 'SpecifiedFindingType'
GROUP BY 
    AssetToReport
ORDER BY 
    AssetToReport;

Subquery runs fine as a standalone query, outer query runs fine without the inner query, and the query as a whole runs fine in code.

Query parameters support

I use SQL CE Toolbox to write and test queries to be used in reporting (I use telerik reporting and Dev Express, but this applies to most .net reporting tools).

In my reports the user supply parameters that translates to SQL parameters. For example if I have a report that displays sales details by period, I will have a query like this:
SELECT * FROM Sales
WHERE SaleDate >= @DateFrom AND SaleDate <= @Dateto

I always use SQL CE Toolbox to write the query without parameters, and I add the parameters once I take the query to my reporting tool.
It will be useful to get the tool ask for parameter values when running the query, or may be having some proprietary syntax to declare parameters (similar to SQL Server declare).

comments

ErikEJ wrote Sep 12 at 5:28 PM

Great idea, that would be a very useful feature.
How about having a permanent list of parameters with name, data type, size, and value, and then let the query execution engine match any it can find in the supplied sql?

Having a proprietary syntax - not so sure...

ErikEJ wrote Sep 13 at 10:02 AM

The parameters grid would contain the following columns: Name, Data type, Size, Value

Ordered by name when first opened

For example:
@StartDate, DateTime, 8, 2015-09-13

(The default size will be based on the data type)
https://msdn.microsoft.com/en-us/library/system.data.common.dbparameter(v=vs.100).aspx
(Similar to the Table designer)

The available DbType values would be based on the possible SQL Compact data types only.
https://msdn.microsoft.com/en-us/library/system.data.dbtype(v=vs.100).aspx

The list will be permanently stored in the same store as the connection is used for.

The parameter names and values used with be listed in the result message

wrote Sep 13 at 10:03 AM

HishamKedjour wrote Sep 13 at 11:21 AM

Just a thought,

I think we can easily parse the type from the query. Usually parameters are used in WHERE clause with some operators (= <, BETWEEN…). The other operand is usually a column.

In the first implementation, we can get the other operand (a column name). From there we can check the database for data type and size. There is no need at first to get the exact table. We just use the first match.

ErikEJ wrote Sep 13 at 4:43 PM

Thanks for the design feedback - I think " easily parse the type from the Query" will be a pit of failure. Also "guessing" parameter sizes it never a good idea.
How about adding a third pane (optional) above the Query text and the results, which contains the defined parameters with values?

HishamKedjour wrote Sep 13 at 6:06 PM

Let me summaries how I saw things. There is two scenarios:

1 – Using a parameters pane:

As you said, adding a third pane that contains the defined parameters as a small grid. The user will fill the parameters information (name, type, size, and value).
The tool can also detect parameters, and fill the grid as the user is typing. In this case, the user will supply the type, the size, and the value.

As a step further, the tool can guess the parameter type and size, in this case the user will only supply the value. If the tool guessed wrong, the user will correct it.
What I put as a first implementation, is a quick algorithm for guessing. It will work perfectly for users who have a consistent naming convention in their database.

Saving the query: Actually, the query is saved in plain text. If we add the parameters, we need an easier way to store them with the query. I didn’t understand what you meant by “stored in the same store as the connection is used for”. In the worst scenario, they can be stored in a file with a same name and a different extension as the query.

2 – Using some syntax (I’m avoiding the word proprietary)

In this case we don’t need a new pane. We need only a syntax that can be used to define parameters. This syntax can even be put as comment. For example:
/_Parameters:
@StartDate, DateTime, 4, '01/13/2015'
@ToTal, int, 4, 23
*/
In this example the tool will just parse the comment that start with /_Parameters: and extract a CSV list of parameters and theirs values.

Saving the query: In this scenario saving the query need no additional effort.

I hope that you get my ideas this time.

ErikEJ wrote Sep 13 at 7:49 PM

Thanks again. I really like your parameters a comments idea, it will even be possible to add a button to insert a parameters header, so the feature is discoverable.
I think the order should be: Name, datatype, value, optional size

HishamKedjour wrote Sep 13 at 10:21 PM

Me too, I prefer the comments. That way I can store them with the query within my reports (I always keep one version of the query).

Thanks a lot.

ErikEJ wrote Sep 14 at 5:35 PM

How about:
DECLARE @DateFrom datetime = '2015-09-15'
DECLARE @Dateto datetime = '2015-10-15'
SELECT * FROM Sales
WHERE SaleDate >= @DateFrom AND SaleDate <= @Dateto

HishamKedjour wrote Sep 14 at 11:31 PM

That will be perfect, it’s similar to SQL Server. There is no need to learn new syntax.

HishamKedjour wrote Sep 15 at 10:29 PM

Another thought.

Since we are not prompting the user for parameters values, and we are not using prepared queries. We can just implement them as constant (kind of C++ #define preprocessor). The tool will just replace the string before execution. Something like:
SET @DateFrom = '2015-09-15'
-- #define @DateFrom '2015-09-15'
SET @Dateto = '2015-with error, the tool will not care!'
SELECT * FROM Sales
WHERE SaleDate >= @DateFrom AND SaleDate <= @Dateto
The tool will just parse the query, remove line that set parameters value and run a string.Replace().
In our example: string.Replace(@DateFrom, "'2015-10-15'")

The tool will get this query that can send to execution:
SELECT * FROM Sales
WHERE SaleDate >= '2015-09-15' AND SaleDate <= '2015-with error, the tool will not care!'

It will be easy to implement, and it will give the same result. We don’t need to know the type or the size of parameters.

Scrolling

Just a small improvement: other Visual Studio components support the mouse wheel scrolling also when the pointer is not located over the scrollbar, SQL CE Toolbox seems not.

SQL CE TSQL commands ?

I need to pass SQL commands (select, update, delete) to sql ce database (sdf) on phone 8.1 app. Is that possible ? Maybe there are some net libraries or via COM access (if possible on phone) ?

VS2015 fatal: unable to load DLL `sqlceme35.dll`

Clicked on the Tools Menu item to open the toolbox ...
sqlcetoolboxcrash

Freezes then crashes VS2015. Uninstalled & re-installed the toolbox with the same result.

Win7 x64 VS2015 with latest updates.

I ran Devenv.exe /log ... and kept the logs, let me know if you want me to send them to you. (note to self: Dropbox \ Dev Stuff)

Problem signature:
  Problem Event Name:   CLR20r3
  Problem Signature 01: devenv.exe
  Problem Signature 02: 14.0.25123.0
  Problem Signature 03: 56f22f32
  Problem Signature 04: System.Data.SqlServerCe
  Problem Signature 05: 3.5.5692.0
  Problem Signature 06: 486146b7
  Problem Signature 07: 11e
  Problem Signature 08: 0
  Problem Signature 09: System.DllNotFoundException
  OS Version:   6.1.7601.2.1.0.256.48
  Locale ID:    3081
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt
System.DllNotFoundException was unhandled
  HResult=-2146233052
  Message=Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
  Source=System.Data.SqlServerCe
  TypeName=""
  StackTrace:
       at System.Data.SqlServerCe.NativeMethods.SafeRelease(IntPtr& ppUnknown)
       at System.Data.SqlServerCe.SqlCeConnection.ReleaseNativeInterfaces()
       at System.Data.SqlServerCe.SqlCeConnection.Dispose(Boolean disposing)
       at System.Data.SqlServerCe.SqlCeConnection.Finalize()
  InnerException: 

Unable to add dates to fields with the datetime datatype

I am unable to import data from a CSV file. I receive the error:
-- Script Date: 1/28/2016 11:50 PM - ErikEJ.SqlCeScripting version 3.5.2.58
-- Cannot create script, one or more field names on first line are invalid:-- Wrong column names WINDOWSTART WINDOWEND
-- Also check that correct separator is chosen.

The first two lines I'm trying to import are
movieAssetID,NvisRunTime,Title,titleAssetId,packageAssetId,TmsStatus,TmsId,WindowStart,WindowEnd,expectedDivCodes
AESM1589691601110000,2016-01-16 16:31:58,First 48 01-14,AEST1589691601110000,AESP1589691601110000,MAPPED,EP006609610497,2016-01-18,2016-04-14,CLT CSC WIL

Also if I try to add dates in any of the supported SQLite date formats I get an error about null fields. They are configured to be NULL.

Empty default values in create table

Hi Erik

VS Community 2015 Update 1 + SQLCEToolbox 4.4.0.4 + db CE4.0
Build Table (beta) + field with default value

SQL generated with empty default value:

-- Script Date: 13/01/2016 10:55 - ErikEJ.SqlCeScripting version 3.5.2.56
CREATE TABLE Faucet (
[Id] int IDENTITY (1,1) NOT NULL
, [Guid] uniqueidentifier DEFAULT NOT NULL
, [Nome] nvarchar(100) NOT NULL
, [Endereco] nvarchar(255) NOT NULL
, [DataCadastro] datetime DEFAULT NOT NULL
, [DataUltimaAnalise] datetime NULL
, [DataUltimoAcesso] datetime NULL
, [DataProximoAcesso] datetime DEFAULT NOT NULL
, [RecompensaMinima] smallint NULL
, [UltimaRecompensa] smallint NULL
, [Saldo] int NULL
, [EntregaRecompensa] tinyint DEFAULT NOT NULL
, [Rede] tinyint DEFAULT NOT NULL
, [Moeda] tinyint DEFAULT NOT NULL
, [IntervaloTempo] smallint NULL
, [DetectarIntervalo] bit DEFAULT NOT NULL
, [DetectarRecompensa] bit DEFAULT NOT NULL
, [DetectarSaldo] bit DEFAULT NOT NULL
, [DetectarSaque] bit DEFAULT NOT NULL
, [Avaliacao] tinyint DEFAULT NOT NULL
, [AvisarTempo] bit DEFAULT NOT NULL
, [Idioma] tinyint DEFAULT NOT NULL
, [ManterAberto] bit DEFAULT NOT NULL
, [Observacoes] ntext NOT NULL
, [PrecisaVerificar] bit DEFAULT NOT NULL
, [Problemas] nvarchar(255) NULL
, [TemFundo] bit DEFAULT NOT NULL
, [TemLogin] bit DEFAULT NOT NULL
, [TemProblemas] bit DEFAULT NOT NULL
, [TemReferido] bit DEFAULT NOT NULL
, [TesteHumano] smallint DEFAULT NOT NULL
);
GO
ALTER TABLE [Faucet] ADD CONSTRAINT [PK_Faucet] PRIMARY KEY ([Id]);
GO

My default values in Build Table: NEWID(), GETDATE() and 0 / 1.

Hugs.

Converting from MDF to SDF

I created a new SDF file using the Right Click | Add Compact 4.0 connection. I then used the script database and schema feature to generate a file I could then use to add the tables and data from my MDF file. I creates the tables but then errors:

Error Code: 80040E14
Message : A quotation mark delimiter is missing from the end of the query.
Minor Err.: 25511
Source : SQL Server Compact ADO.NET Data Provider

It appears I have tables, no primary keys created and no data added. Have I missed something

LINQ to SQLite DataContext Support

Eric -
I've written a block of C# code that generates in C# a strongly-typed LINQ DataContext with its associated Entity classes based on the schema in a SQLite database the Toolbox creates. I spent a few minutes rattling around in the GitHub Toolbox repository to figure out how to contribute it, but don't have time to figure out how to integrate it into your code (if that's even appropriate to attempt). I would be happy to contribute the code if you would be interested in wiring it in. In my view, it would integrate as another right-click option on the database, mirroring the "Add SQLite-net DataAccess.cs to current Project..." option. Please let me know if you are interested and willing to tell me how to post it.
Thanks. Steve
P.S. I've never done this type of thing before and thus am not sure how to go about it. Apologies if this isn't appropriate.

Errors when using Visual Studio 2013 Community

Hi,
I installed the add-in and everything seems to work fine, just as in your video. I am using SQLite 3 for a WPF project. When I right click on my database and select 'Add sql-net DataAccess.cs to current project..' the class file is full of errors:

First:
using SQLite; <---- The type or namespace 'SQLite' cannot be found (I resolved this by using System.Data.SQLite, is this correct?)

Second, in the Create() method:
db.CreateTable(); <---- **System.Data.SQLIte.SQLiteconnection does not contain a definition for 'CreateTable'

Third, in all the generated partial classes:
The type or namespace name 'PrimaryKeyAttribute' could not be found (are you missing a using directive or an assembly reference?)
Same goes for [NotNull], [Unique], and [MaxLength()]

Am I not adding a reference to the proper assembly?

Visual Studio Community Edition 2015

I installed the latest version of the tools, but it did not work; nothing happen when I clicked on the Tools->SQLServer Compact/SQLite Toolbox nor on Server Explorer.

Support for renaming indices

I'm not sure how much effort this would be but it would be great to be able to rename indices.
It is not the first time that I had to dramatically redesign an existing database that already contained a lot of data in it.
SqlCeToolbox allows me to rename tables but most times the index names contain the table name too and for consistency I would like to rename these too.
SDViewer is able to rename indices but seems to crash (or at least take very very long) when I try to rename a table because it always seems to want to display the all (!) records.
At the moment I must use both programs. It would be very convenient to do it all with SqlCeToolbox.

"Build Table" generates an invalid script on Sqlite

My target is to generate a table with an autoincrement integer id (as default in Sqlite https://www.sqlite.org/autoinc.html).
This is the result of "Build Table" generated script:

-- Script Date: 10-Feb-16 17:19  - ErikEJ.SqlCeScripting version 3.5.2.58
CREATE TABLE [Pippoes] (
  [Id] INTEGER NOT NULL
, [Name] nvarchar(100) NOT NULL
, CONSTRAINT [PK_Pippoes] PRIMARY KEY ([Id])
);

Adding a new row to this table throw this error:
SQLite error (1299): abort at 5 in [INSERT INTO Pippoes
VALUES (@p0);]: NOT NULL constraint failed: Pippoes.Id

If instead I generate the table using the following script, it's succeeds:

CREATE TABLE [Pippoes] (
  [Id] INTEGER PRIMARY KEY NOT NULL
, [Name] nvarchar(50) NULL);

SQLite datetime issue

Trying to open Top 200 Rows I got FormatException: String was not recognized as valid DateTime at ErikEJ.SqlCeToolbox.ToolWindows.ResultesetGrid.LoadData(String sqlText)

The connection string has DateTime Kind=Utc option. (The ServerVersion is 3.8.10.2)

did a more experiments with it. SQLiteStudio showed the raw values - it seems to be stored in unix format and somehow wrongly (I can’t figure why it is caused by infrastructure - I am using SQlite-net, SqLitePCL.raw dlls got through Nuget as the infrastructure, SQLiteConnection is constructed with storeDateTimeAsTicks = true as default setting.) . (e.g. stored 622159416000000000 value is interpreted as 18.7.1972 22:00:00 by the infrastructure).

Then I experimented with SQLiteStudio, to figure out the SQLite Toolbox is able to show date time stored as correct unix format. I cloned the original table structure to a different table, then insert one row through SQL INSERT statement and using function strftime('%s', 'now'.) Then using function Datetime(MyDateTypeColumn, 'unixepoch') in SQL SELECT statement showed it correctly. And of course the SQLiteStudio showed the value in raw format in the grid – an integer number (even for the original case, which was quite valuable for me).
I looked at SQLite Toolbox, Edit top 200 Rows, View Data as Report, Script as SELECT execution all raised the exception. Only using replacing MyDateTypeColumn Datetime (MyDateTypeColumn, 'unixepoch') in , Script as SELECT was successful.

Question (or kind of suggestion)from that all: What do you think, if the SQLite Toolbox, Edit top 200 Rows, View Data as Report, Script as SELECT execution shows raw values in grid for Datetime SQLite type by default (not doing any date time conversion) , like SQLiteStudio seems to do? (Or if have some setting which kind of implicit date time conversion is used for that with possibility of no conversion?)
I tried to use SQLite very recently, so I might miss something important. Then please excuse me if the suggestion sounds stupid to you.

file attachments

◾ EmployeeService.zip [x]

comments

Mojmir wrote Oct 3 at 6:34 AM

Additional info to question about connection string:
The database was originally created with DateTimeKind=Utc option.
Because some problems with original provider libraries, I changed the provider to SQlite-net-pcl (https://github.com/oysteinkrog/SQLite.Net-PCL)
Now I see the provider does not allow open db file with a custom connection string. So there is simply called SQLiteConnection ctor with database file path argument. (trying to put there connection string failed on runtime)
To the question, not I haven’t tried setting DataTimeFormat to UnixEpoch in the connection string so far. (To do it I should probably change the SQLite provider lib? Any advice?)

It all happened on education kind of work, so I can share it (in the attachment)

ErikEJ wrote Oct 3 at 11:41 AM

I am using the System.Data.SQLite ado.net provider - It looks to me like the data in that column does not allow itself to be converted to datetime

SQLite datetime issue

Try out this solution:

-- Script Date: 20-01-2016 09:06 - ErikEJ.SqlCeScripting version 3.5.2.56
SELECT [Id]
,datetime([created]) AS [created]
FROM [table];

SQLite datetime values not edited in visual mode

Value of datetime fields in Table Edit (Edit Top 200 Rows) of SQLite table will be back (not saved) in visual mode. For example if you change value of all fields and press save and refresh buttons in below screen datetime values not saved and back to old value.

image

Diff api - changes to FK actions not detected

I have a problem when I change a existing foreign key. Only added and deleted FKs are considered. We changed an existing foreign key and no script for this foreign key changes have been generated.
For example: The origion constraint looks like this
ALTER TABLE [RecipeSetValueRowSet]
ADD CONSTRAINT [FK_RecipeRecipeSetValueRow]
FOREIGN KEY ([RecipeId])
REFERENCES RecipeSet
ON DELETE NO ACTION ON UPDATE NO ACTION;

We changed the ON DELETE to CASCADE and no update script is generated in this case.

Download compiled stand-alone app?

Is it possible for one to download the compiled stand-alone app SqlCe40Toolbox.exe without going through the Visual Studio gallery or compiling the source code? Our application uses SQL CE on the back-end and we have historically recommended users use your stand-alone tool for manual database editing.

But since you moved to github, it is not clear to me how one can get the exe. It used to be a convenient link on the CodePlex home page.

Thanks,
Roger Martin
Gallery Server
galleryserverpro.com

Diff api - change nullable column to not nullable

I changed a nullable column to non nullable and compared the dbs. The generated script looks like this:
-- Script Date: 05.05.2011 11:31 - Generated by ExportSqlCe version 3.5.0.11
ALTER TABLE [TABLE] ALTER COLUMN [COLUMN] nvarchar(4000) NOT NULL
GO

I think the generated script should look like this (in this case the default value is '')
UPDATE [TABLE] SET [COLUMN]='' WHERE [COLUMN] IS NULL
GO
ALTER TABLE [TABLE] ALTER COLUMN [COLUMN] nvarchar(4000) NOT NULL
GO

Best regards
Matthias

Diff api - Unique names for foreign keys error

If two tables have foreign keys with the same name an index is appended in
IRepository.GetAllForeignKeys()

This results to an error in SqlCeDiff.CreateDiffScript(...):
List targetFKs = targetRepository.GetAllForeignKeys().Where(fk => fk.ConstraintTableName == tableName).ToList();
targetFKs has wrong foreign key names resulting in a script like
ALTER TABLE [MyTable] DROP CONSTRAINT [FK_bla_grmpf1];

instead of
ALTER TABLE [MyTable] DROP CONSTRAINT [FK_bla_grmpf];

This problem did not occur in a previous version e.g. 3.5.1.14 (Build 85301)

Temporarly it helped to restore the old algorithm using GetAllForeignKeys(string tableName):
List sourceFKs = sourceRepository.GetAllForeignKeys(tableName);
List targetFKs = targetRepository.GetAllForeignKeys(tableName);
Currently I don't see the necessity to fetch all foreign keys table name independant (and so possibly made
unique) as they are still filtered afterwards with Linq.

But never mind. No offense. The project is still great.

Enhance SQL CE DDEX provider(s) to support Data Source Configuration Wizard

When creating a report from scratch and I'm using C# by the way.
It either gets stuck by the add connection form or it allows me to use the connection but gives an error on the part were you select which table or view to use.
Am I just using it wrong or is there another area specifically for SqlCe reports?
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.