TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sneha K
941
527
195.6k
how to store array list data into db using asp.net mvc4?
Jan 8 2016 7:15 AM
I have six fields
TinNo, CstNo, PanNo, CinNo, ServiceTaxNo, ExciseRegNo
in my view . each field have default Guid eg TinNo means(
TinNo= FD713788-B5AE-49FF-8B2C-F311B9CB0CC4
) I need to save those six fields in same column but not in same row and same cell of TaxInfoTaxField Table . TaxInfoTaxFiled table contain
TAXINFOTAXFIELDID, TAXFIELDID,FIELDVALUE,
that is i need to save those six field values which is entered in view in
FieldValue
column and their id's in TaxFieldID column .it need to save row by row . so i decided to put that default guid's in one list and fields in one list and call where we want.
My View
The Default guid is already saved in TaxField table
Need to save in format
ArrayList objValue = new ArrayList();
{
objValue.Add(TITFVM.TinNo);
objValue.Add(TITFVM.CstNo);
objValue.Add(TITFVM.PanNo);
objValue.Add(TITFVM.CinNo);
objValue.Add(TITFVM.ExciseRegNo);
objValue.Add(TITFVM.ServiceTaxNo);
}
List<Guid> LG = new List<Guid>();
LG.Add(new Guid("FD713788-B5AE-49FF-8B2C-F311B9CB0CC4"));
LG.Add(new Guid("64B512E7-46AE-4989-A049-A446118099C4"));
LG.Add(new Guid("376D45C8-659D-4ACE-B249-CFBF4F231915"));
LG.Add(new Guid("59A2449A-C5C6-45B5-AA00-F535D83AD48B"));
LG.Add(new Guid("03ADA903-D09A-4F53-8B67-7347A08EDAB1"));
LG.Add(new Guid("2F405521-06A0-427C-B9A3-56B8931CFC57"));
var taxinfotaxfieldID = Guid.NewGuid();
var listFiled = new List<TaxInfoTaxFiled>();
for (var item = 0; item < objValue.Count; item++)
{
listFiled.Add(new TaxInfoTaxFiled
{
TaxInfoTaxFieldID = taxinfotaxfieldID,
TaxFieldID = new Guid(LG[item].ToString()),
FieldValue = objValue[item].ToString()
});
}
db.TaxInfoTaxFiled.Add(listFiled );
db.SaveChanges();
return View();
}
All are working Fine looping is working fine it count the values. But I got error in
(
db.TaxInfoTaxFiled.Add(listFiled ); it show overload error near to list field . i donno what is my error is .Any one help me to find out my error and tell m ethe problem is ?.
Advance Thanks...
Reply
Answers (
9
)
How to create an article or a blog?
how to get current location in angularjs ?plz help me guys..