3
Answers

Filling DropDown And Uploading Files in MVC

Pravin Ghadge

Pravin Ghadge

7y
225
1
Hi All,
 
I am doing project in MVC for Importing Data from Excel file.
 
My Task: 
1) Fill Drodpdown
2) Upload Excel.
 
Both Codes are working individually correctly
 
But when i integrate and run, at that time while uploading it gives error.
 
Answers (3)
0
Vasu Gadhiya

Vasu Gadhiya

NA 594 59.1k 10y
however you take Column name "Date".

date is a reserved keyword.
You need to use square brackets around it to use in a query.

-------------------------------
string query = "insert into income_new(Cid, rs, rate, period, [date]) values ('" + cid + "','" + txt_Rs.Text.Trim() + "','" + txt_Rate.Text.Trim() + "','" + txt_Period.Text.Trim() + "','" + DateTime.Now + "')";
-------------------------------

If it is possible, I strongly suggest to change these names because you will have this problem everytime you hit this table.

Access 2007 reserved words and symbols
http://office.microsoft.com/en-us/access-help/access-2007-reserved-words-and-symbols-HA010030643.aspx
Accepted
0
prince raj

prince raj

NA 88 26.6k 10y
Thanks Vasu Gadhiya

its my fault to use keyword as Column name.
0
Anupam Singh

Anupam Singh

NA 5.8k 886.7k 10y
Hi prince ,

You can try to insert DateTime.Today instead of DateTime.Now
0
Akhil Mittal

Akhil Mittal

NA 21.9k 2.9m 10y
I think you need to check with the format of datetime that your are inserting