sqlite中这个错误的含义是什么? [英] what's the meaning of this error in sqlite ?

查看:91
本文介绍了sqlite中这个错误的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

有人可以帮我理解这个奇怪的sqlite错误的含义及其原因是什么?

它在C#

和这里我的C#代码。

Hi.
Can someone please help me to understand the meaning of this peculiar sqlite error and what's the cause of it ?
it's in C#
and here's my C# code.

try
            {
                string query = @"insert into tbl (pkey, field)
                            values (@_pkey, @_txt);";

                string conString = @"Data Source = \testdb.s3db; version = 3;";
                SQLiteConnection con = new SQLiteConnection(conString);
                con.Open();
                SQLiteCommand cmd = new SQLiteCommand(query, con);
                cmd.Parameters.Add("@_pkey", System.Data.DbType.Int32).Value = 10;
                cmd.Parameters.AddWithValue("@_txt", "hello world");
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            { Console.WriteLine(ex.Message); }





但是当我点击运行时,它会在cmd中显示。





But when I click the run, it displays this in the cmd.

SQL logic error or missing database
no such table: tbl
Press any key to continue . . .





我确定有一个数据库和一个适合查询的表格。

我试过更改表名。



这有什么问题?



提前致谢。



And Im dead sure that there's a database and a table which fits the queries.
I tried changing the table name.

What's the wrong with this ?

Thanks in advance.

推荐答案

您的连接字符串可能有问题...尝试
Your connection string is probably at fault ... try
string conString = @"Data Source = c:\myFolder\testdb.s3db; version=3;";

用数据库的实际路径替换 c:\ myFolder

replacing c:\myFolder with the actual path to the database


这篇关于sqlite中这个错误的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆