Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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?




C#
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;
}


What I have tried:

i dont know what should i do to fix this problem!
Posted
Updated 17-May-17 19:08pm
v4
Comments
[no name] 14-Jul-16 3:11am    
saeed rajabi 14-Jul-16 4:20am    
now i want insert with entity framework


i update my question please look again!
[no name] 14-Jul-16 5:40am    
Maybe this helps and please take into account, the only things I recognized where the Screen shots :)
.NET Tips - افزودن یک DataType جدید برای نگه‌داری تاریخ خورشیدی - 1[^]
Richard Deeming 14-Jul-16 10:02am    
Simple - do not store dates as strings. Use date as the SQL data type, and DateTime as the C# data type.

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.
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900