locked
How to connect ".db" file as a database in vb.net? RRS feed

  • Question

  • Hello, how can I use a database.db file to connect to the sql database:

    Imports System.Data.SqlClient
    Imports System.Data.Sql
    
    Public Class Form1
    
    Dim sqlconn As New SqlConnection("Db\guardar.db")
    sqlconn.Open()
    
    End Class

    As you can see, this code is a bit wrong. Could you help me? What package should I import?

    Thursday, February 7, 2019 2:27 AM

All replies

  • Your imports are pointing to MS SQL Server usage.

    Db\guardar.db I don't know what that is, becuase it's not a MS SQL Server Express LocalDb MDF file..

    Thursday, February 7, 2019 3:51 AM
  • is a database file created with the following software:

    DB Browser for SQLite

    Thursday, February 7, 2019 5:22 AM
  • I have never used SQLite, but it seems kind of straight foreword and simple to use.

    zetcode.com/db/sqlitevb/

    https://www.codeproject.com/Articles/1210189/Using-SQLite-in-Csharp-VB-Net#Read%20a%20Record%20from%20a%20Table



    Thursday, February 7, 2019 7:22 AM
  • You need to create a link server via ODBC. Follow step 1 thru 4 below.

    https://www.mssqltips.com/sqlservertip/3087/creating-a-sql-server-linked-server-to-sqlite-to-import-data/


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, February 7, 2019 10:30 AM