Access sqlite from a remote server

前端 未结 8 1184
悲哀的现实
悲哀的现实 2020-11-28 15:05

I am wondering how i can access an sqlite database that is sitting a remote server.I have read threads discouraging it but i need to do it if its possible.

          


        
8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 15:39

    SQLite is file-based only. There is no way to talk to it over TCP/IP.

    Like an Access database file, you have to have the database file in a network shared folder. The path is usually going to be a UNC path, like "\server\sharename\folderpath\databasefile".

    The problem is the connection string you built isn't a connection string. It's a partial string. You have this:

    DataSource = @"\\\\" + txtipaddress.Text + @"\qscanDBAttacheds\test.s3db;Version=3;New=False;Compress=True;"
    

    The "DataSource" part has to be part of the string you build. You don't have that. You need this:

    string connString = @"Data Source=\\" + txtipaddress.Text + @"\qscanDBAttacheds\test.s3db;Version=3;New=False;Compress=True;"
    

提交回复
热议问题