为什么sqlite会转换。至 , [英] Why does sqlite converts . To ,

查看:71
本文介绍了为什么sqlite会转换。至 ,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我现在对SQLite完全感到困惑。

我使用C#的System.Data.SQLite版本



我有两张桌子:



表1:

其中我创建了两个列(更多,但在这种情况下它们是重要的,并且声明是很长的发布方式)。第一个叫做RecStat,第二个叫做DOXinM。

两者都是十进制,并且是这样创建的:

...

< pre lang =SQL> [RectStat] 十进制
[DOXinM] 十进制



...



Create Table语句如下所示:

< pre lang =SQL> 创建 如果 存在 Table1

(..Columns ..);



当我插入一个值时这个表十进制工作完全正常,当我读出来它也在xaml GUI上工作。



之后我创建了第二个表,它也有一个十进制列。

我以同样的方式创建了表(这是一个简短的表,所以我可以给出整个声明)

 创建  < span class =code-keyword>如果  存在   Table2
[ID] Integer < span class =code-keyword> Null 主要 密钥
[材料] VarChar 10 ],
[厚度] 十进制);





在这两种情况下,我都为十进制列执行相同的插入:

  插入表1('  RectStat' values '  10.5'); 
插入表1('' DOXinM'' < span class =code-string> 1.3');
插入表2('' 厚度'' < span class =code-string> 0.25');





现在数据库将前两个语句作为10.5插入/1.3和最后一个为0,25

当我读出值时,前两个工作完全正常,但最后一个显示没有小数点后面的数字。



所以我的问题是。

为什么会发生这种情况?

(顺便说一句,我的表中有超过20个十进制列,而厚度是唯一有此问题的列)



我希望你能帮助我。



提前致谢

Richard



我尝试了什么:



尝试了不同的价值观(希望它能够实现)是因为0.25)

尝试没有''。但是声明认为它有两个列的三个值...

解决方案

我仍然不理解错误,但我找到了解决方案。

我想我参与化我的价值观的方式有问题。



我尝试了Björn在这个链接中提出的建议: [ ^ ]



对我来说


Hello everyone,

I am completely confused by SQLite right now.
I use the System.Data.SQLite Version for C#

I have two Tables:

Table 1:
In it I have created two columns (more but they are the important in this case and the statement is way to long to post it). The first one is called RecStat and the second one DOXinM.
Both are a Decimal and are created like this:
...

[RectStat] Decimal,
[DOXinM] Decimal,


...

The Create Table statement looks like this:

Create Table If Not Exists "Table1"

(..Columns..);

When I insert a value in this table the decimal works perfectly fine and when I read it out it works too on the xaml GUI.

After that I created a second Table which also has a Decimal Column.
I Created the table the same way (this is a short one, So i can give the whole statement)

Create Table If Not Exists "Table2" (
 [ID] Integer Not Null Primary Key,
 [Material] VarChar(10],
 [Thickness] Decimal);



In both case I do the same insert for the Decimal Column:

Insert into Table1 ('RectStat') values ('10.5');
Insert into Table1 ('DOXinM') values ('1.3');
Insert into Table2 ('Thickness') values ('0.25');



Now the Database inserts the first two Statements as 10.5/1.3 and the last one as 0,25
When I read out the value the first two works perfectly fine but the last one is shown without the numbers after the decimal "point".

So my question is.
Why does this happens?
(Btw I have more than 20 Decimals columns in my table and the "Thickness" is the only one with this problem)

I hope you can help me.

Thanks in Advance
Richard

What I have tried:

Tried different Values (Had the hope that it was because of the 0.25)
Tried it without the ''. But than the statement thought it had three values for two columns...

解决方案

I still don't understand the error but I found a solution.
I guess there was something wrong with the way I was parameterizing my Values.

I tried what "Björn" suggested in this link: [^]

That worked for me


这篇关于为什么sqlite会转换。至 ,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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