c# - How to get the Dataset if there are null values in some of the fields -


  डेटासेट डीएस = ast.GetUserLoginInfo (परम); अग्रगण (डीएसटीबल्स में डाटारोव डॉ। [0] .रो।) {यदि (डीएसटीबल्स.काउंट & gt; 0) {यदि (डीएसटीबल्स [0] .रोव.काउंट & gt; 0) {_userstate.ID = कन्वर्ट ToInt32 (ds.Tables [0] .Rows [0] [ "आईडी"]); _userstate.Name = Convert.ToString (ds.Tables [0] .Rows [0] ["नाम"])। ट्रिम (); _userstate.Email = Convert.ToString (डीएसटीबल्स [0] .Rows [0] ["ईमेल"]) .ट्रिम (); _userstate.Username = Convert.ToString (ds.Tables [0] .Rows [0] ["उपयोगकर्ता नाम"])। ट्रिम (); _userstate.GroupId = Convert.ToInt32 (डीएसटीबल्स [0] .रोव [0] ["ग्रुपआईड"]); _userstate.BranchId = Convert.ToInt32 (डीएसटीबल्स [0] .राओ [0] ["शाखा आईडी"]); _userstate.BranchId = Convert.ToInt32 (डीएसटीबल्स [0] .राओ [0] ["डिप्टीआईडी"]); _userstate.RoleId = Convert.ToInt32 (डीएसटीबल्स [0] .रोव [0] ["रोलआईड"]); _userstate.IsActive = Convert.ToBoolean (डीएसटीबल्स [0] .राओ [0] ["आईएक्टिव"]); _siteuser.UserStat = _userstate; }   

कुछ उपयोगकर्ताओं के लिए BranchId रिक्त है क्योंकि वे सिर हैं और सभी शाखाएं उनके अधीन आती हैं। इसलिए जब कोई उपयोगकर्ता लॉग इन करता है तो डेटासेट डेटासेट में देता है।

सभी क्षेत्रों के लिए इस कोड का उपयोग करें, < / p>

  _userstate.id = Convert.ToInt32 (ds.Tables [0] .राओ [0] ["आईडी"] == रिक्त? 0: डीएसटीबल्स [0] .Rows [0] [ "आईडी"]); _userstate.Name = Convert.ToString (डीएसटीबल्स [0] .राओ [0] ["नाम"] == रिक्त? "" डीएसटीबल्स [0] .रोव [0] ["नाम"])। ट्रिम ( );    

Comments

Popular posts from this blog

Selenium IDE Conditional Statements -

sql - Select count and aggregate, but only unique -

java - Convert spaces to underscores -