Wednesday, March 12, 2014

Simple way to create xml and save into database sql server


 INSERT INTO [tbllayerobject]           
                      ([id],           
                       [layerid],         
                       [objectname],           
                       [objectdescription],           
                       [inventoryitemid],        
                       [geojson],     
                       [layerobjecttypeid])           
                       SELECT Newid(),           
                        @LayerId,           
                        @ObjectName,          
                        @ObjectDescription,                                   
                        @InventoryItemId,                                
                        x.y.value('geojson[1]', 'nvarchar(max)') AS geojson,     
                        x.y.value('layerObjectTypeId[1]', 'uniqueidentifier') AS layerObjectTypeId                                                            
                        FROM  @GeoJson.nodes('columns/column') x(y)

string[] arrGeoJson = new string[2];
                    string strGeoJson = "";
                    foreach (string str in arrGEOjson)
                    {
                        arrGeoJson = str.Split('^');
                        var xmlStrGeoJson = "";
                        xmlStrGeoJson += "" + arrGeoJson[0] + "";
                        xmlStrGeoJson += "" + arrGeoJson[1] + "";
                        xmlStrGeoJson += "
";
                        strGeoJson += xmlStrGeoJson;
                    }
                    strGeoJson += "
";
                    objLayerObjectBO.GeoJson = strGeoJson;

No comments:

Post a Comment

fill in blanks

ALL Reading Blanks: Special All approaches aim to increase blood flow to areas of tension and to release painful knots opt1 muscle kn...