如何在SQL中使用实体框架插入波斯数? [英] How can I insert persian number in SQL with entity framework?

查看:45
本文介绍了如何在SQL中使用实体框架插入波斯数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想手动插入sqlserver 2014

db:booking,table:reserved(reservedId,RoomId,UserId,Start_date,End_date)

我的dbs整理是:persian_100_ci_ai

当我插入波斯日期时它会保存如下:???? / ?? / ??

但是英文如:1395/04/02

我该怎么办?









hi ,i want to insert manually into sqlserver 2014
db : booking , table : reserved(reservedId,RoomId,UserId,Start_date,End_date)
my dbs collation is : persian_100_ci_ai
when i insert persian date it will save like : ????/??/??
but in english like : 1395/04/02
what should i do?




public static RESERVED insert_res(int room_id, string s_date, string e_date)
{
    RESERVED a;
    using(bookingEntities db = new bookingEntities())
    {
        a = new RESERVED();
        a.ROOMID = room_id;
        a.USERID = 3;
        a.START_DATE = s_date;
        a.END_DATE = e_date;
        db.RESERVEDs.Add(a);
        db.SaveChanges();
    }
    return a;
}





我的尝试:



i不知道我该怎么做才能解决这个问题!



What I have tried:

i dont know what should i do to fix this problem!

推荐答案

猜测波斯数字不是阿拉伯数字。

你得到的是一串符号,这些符号是波斯数字符号。

要么按原样使用它们并将它们存储为字符串,但你不能用它们进行任何微积分。

要么将波斯符号翻译成阿拉伯数字,那么您可以将它们转换为数字(int或float)或日期。那么你可以用它们来处理所有你用int或浮点数做的事情。



我担心你必须建立一些函数来将波斯符号转换为阿拉伯符号并反转。



计算机语言只能通过阿拉伯数字处理数值。

在阿拉伯数字和阿拉伯数字之间找到函数可能会更容易。罗马数字。原则应该足够接近,可以用作模型。
Guessing that Persian numbers are not arabian numbers.
what you get is a string of symbols that are the Persian number symbols.
Either you use them as is and store them as strings, but you can't do any calculus with them.
Either you translate the Persian symbols to Arabian numbers, so that you can then convert them to numbers ( int or float) or dates. Then you can do with them all what you do with ints or floats.

I fear you have to build a couple functions to convert Persian symbols to Arabian once and reverse.

Computer languages only handle numeric values via Arabian numbers.
It will probably be easier to find functions that do the trick between Arabian numbers and Roman numbers. The principle should be close enough to be used as a model.


查看这篇文章:



将farsi数据插入sql数据库 [ ^ ]
check this post :

insert farsi data to sql data base[^]


这篇关于如何在SQL中使用实体框架插入波斯数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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