我正在尝试修改为 SQLite DB 与 OleDb 数据库建立连接所做的例程。
public SQLiteConnection ConnOpen()
{
// == Assegnazione variabili ==
StreamReader ioRead;
int Conta;
//Se si mette il TestVB.txt sul desktop usare le righe sotto
//stringafile = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
//stringafile += @"\TestVB.txt";
Conta = 1;
ioRead = File.OpenText(@"C:\Simon\TestVB.txt");
while (ioRead.Peek() != -1)
{
if (Conta == 1)
{
Para1 = ioRead.ReadLine();
// MessageBox.Show(Para1)
}
if (Conta == 2)
{
Para2 = ioRead.ReadLine();
// MessageBox.Show(Para2)
}
if (Conta == 3)
{
Para3 = ioRead.ReadLine();
// MessageBox.Show(Para3)
}
if (Conta == 4)
{
Para4 = ioRead.ReadLine();
// MessageBox.Show(Para4)
}
Conta += 1;
if (Conta > 4)
{
break;
}
}
ioRead.Close();
SqlConn = new SQLiteConnection("Data Source =" + Para1 + @"\Simon_DB.db");
try
{
SqlConn.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
return SqlConn.Open();
例程在“return SqlConn.Open()”结尾处失败,并出现错误 CS0029“无法以隐式方式转换“System.Data.SQLite.SQLiteConnection”中的“void”类型” 你能帮助我吗? 谢谢!
对不起!我犯了一个错误 。现在一切正常了!