How to insert Option datatype field by using webservices?

Ashish_Gupta
Member Posts: 56
I have made webservice and also create object to create record in navision database but my table contain option datatype field?
how to insert the value form asp.net with c#.net using webservice. ](*,)
how to insert the value form asp.net with c#.net using webservice. ](*,)
Ashish Gupta
Navision Technical Consultant
Navision Technical Consultant
0
Answers
-
An option is just an integer. You'll need to map your options to their integer values and insert them.0
-
line1.Type = SalesOrderRef.Type.Item;
You can look on this post as example
http://blogs.msdn.com/freddyk/archive/2 ... d-rtm.aspx0 -
i want to fill gender field which is option datatype in navision table through the drop down list in asp.net with c#,net .
contact.Gender =ddl_gender.SelectedValue.ToString()
i got error
Cannot implicitly convert type 'string' to 'ContactCardservice.Gender'
help me ](*,)Ashish Gupta
Navision Technical Consultant0 -
here is an example on how to create a customer record. I'm assuming the values for Option to be Male Female.
MyContact.Contact_Service ContWS = new WebServiceApp.MyContact.Contact_Service(); ContWS.UseDefaultCredentials = true; MyContact.Contact MyCont = new WebServiceApp.MyContact.Contact(); MyCont = ContWS.Read("10000"); MyCont.Name = "New Name"; MyCont.Gender = MyContact.Gender.Male; ContWS.Update(ref MyCont);
Since in your app the option are string, you need to compare string and then assign it.
if MyContact.Gender.Male.toString = ddl_gender.SelectedValue.ToString then
MyCont.Gender = MyContact.Gender.Male
else
MyCont.Gender = MyContact.Gender.Female
I don't have VS in front of me to confirm this.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions