问题描述:

Hello all my fellow Coders.

I tried quite a few methodes now on how to connect into a .db file that I got from Spiceworks.

I wanted to make a program that will add stuff to the spiceworks db file and to another sql db that is running at the same time.

does anyone have any suggesions on how to do this? I am kinda out of idears and I tried alot :/

spiceworks_prod.dll is the file name and is the name from spiceworks cant share the file, there is some information I cant share on it.

I hope somone can come with a good fast solution for me

网友答案:

I figured out how to do it I was suppose to use SQLite that I had to add to visual studio that I downloaded here SQLite Homepage From there on I just followed this guide Guide for setting up SQLite and wooptiedou it worked I will post my solution underneath on how I ended up doing it.

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

 namespace Spiceworks_console 
{ 
class DBControl 
{ 
#region SpiceWorks 
SQLiteConnection m_SpiceWorksConnection;

 public bool ConnOpenSpiceWorks() 
{ 
try 
{ 
m_SpiceWorksConnection = new SQLiteConnection("Data Source=C:\\Program Files (x86)\\Spiceworks\\db\\spiceworks_prod.db;Version=3;New=True;");
 m_SpiceWorksConnection.Open(); 

Console.WriteLine("Connected to SpiceWorks DB"); 
return true; 
} 
catch(Exception ex) 
{ 
Console.WriteLine(ex); 
return false; 
} 
}
相关阅读:
Top