Just install the sqlite extension in your visual studio code: VSCode-SQLite; Then you can right-click on the database file and click 'Open Database'. SQLite database in visual studio code; Expand the database. Expanded sqlite database in vscode; Click the play button in front of each table to view table contents. SQLite table in visual studio code. Django Tutorial in Visual Studio Code. Django is a high-level Python framework designed for rapid, secure, and scalable web development. Django includes rich support for URL routing, page templates, and working with data. The only Atom plugin I'm finding for sqlite is a plugin for the Quick Query plugin. For VSCode, the SQLTools plugin has sqlite support on its roadmap but no support yet. Visit the System.Data.SQLite.org website and especially the download page for source code and binaries of SQLite for.NET. Alternative Source Code Formats: sqlite-src-3350500.zip (12.23 MiB) Snapshot of the complete (raw) source tree for SQLite version 3.35.5. See How To Compile SQLite for usage details.
Step 1: Install VS2017
I assume you know how to install visual studio 2017. so I ingore this step here.
Step 2: Download SQLite component
Download sqlite.h、sqlite.dll、sqlite.def files from SQLite official website.
- Download the source code. There is the sqlite.h file inside the source code.
2. Download the sqlite.dll and sqlite.def according to your system.(my system is x64)
Step 3: Create a lib file
Find the lib.exe executable in Vistual Studio on your system.
In my case, the file path is “C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.16.27023binHostx64x64lib.exe”.
Then, copy sqlite.def file to this folder and run the below command.
After doing that. You will get a *.lib file.
Note:
- If it fails to run the above command, you can try to copy the x64 folder outside of your Vistual Studio path and run the command again.
- If there is an error likes service error, you need to use administrator privilege to run the command.
Step 4: Add lib file to Vistual Studio
- Open Vistual Studio 2017 and create a project.
- Put sqlite.h and sqlite.dll files into project folder(the same path with source code)
- Browser to Project Properties->connector-> input->additional dependency and include *.lib(we created it in step 3) path.
Now, we can use SQLite in Vistual Studio 2017.
Step 5: Test
Below code is used to test if we can use SQLite in Vistual studio.
Note:
You can download a Database Browser to check the result or you can read the data from database after you have written it.
Related article:
Transcript from the 'Working with SQLite' Lesson
[00:00:00]
>> Burke Holland: So let's take a look at how we can use SQLite within VS Code. What I need to do first is, I want to open a terminal instance. And then from here, what we need to do is we need to create a data directory. And I've actually already got one, so I'm gonna say, remove the data directory.
[00:00:24] We'll start from scratch. By the way, if you're on a Mac, and you didn't know, Cmd+K clears out the screen. Also, Ctrl+U clears off the current line. Cmd+K, Ctrl+U, those are magical commands if you're on Bash. So let's create a data directory. And then we're gonna move into that directory.
[00:00:49] And you can see it appeared over here. I don't know if you saw but it's now in the Explorer. So I'm gonna say sqlite3. And because I've already included that, this command is just gonna run. And I'm gonna say lamp.db. And I'm gonna run this, and I'm gonna just hit databases to make sure that it's there.
[00:01:07] There it is. And I'm gonna quit. If we do a list now, we see we have a lamp.db file. So we can now start interacting with this file from VS Code because it is a valid SQLite database. So let's do this. Cmd+Palette, Ctrl, Cmd+Shift+P, SQLite. And we're gonna say, open database.
[00:01:34] And it's gonna wanna know which one. It automatically picked up this one, we'll select that. And now we have a SQLite Explorer over here. And inside is our database. And what we can do here is run a new query. And let's do some things here. So let's do, let's go back to the Explorer from my workspace.
[00:01:57] Let's run some SQL here. So what I'm gonna do is create a table called colors. So we'll do this and we can run this. So we highlight it and we say, sqlite, run selected query. Boom. Okay, and now let's do, let's insert. In fact, let's grab both of these items.
Sqlite Visual Studio Codes
[00:02:19] Let's highlight just this line, run selected query, okay? And then let's highlight just this line, run selected query. There we go. All right, and now we're getting data back from SQLite. So you can see if you have a SQLite database in your project, you can use it directly from VS Code.
Visual Studio Code Vs Visual Studio
[00:02:42] And you can interact with it without ever leaving your editor, which is pretty cool. I wanna do one more just to show you what's possible. There are other possible database options. The other one that we see quite a lot, quite a bit of use from is MySQL. A lot of people use MySQL.
[00:02:58] I've given you an entire MySQL database as part of this dev container. I'm sorry in advance to the Internet here. So, whether or not you have MySQL installed, you will have to open this project.