.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Locations in XML Format ... code example ... LINQ ..

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :ASP.Net
Hello Experts ...As i am begienner ..Kindly Help in Finding the Solution ---- i am using a webservice ,api which will return data in XML Formant .. I will pass IP Address in WebService / API . This will return this data ....<Locations>  <Location id="0">     <Ip></Ip>     <Status>OK</Status>     <CountryCode>US</CountryCode>     <CountryName>United States</CountryName>     <RegionCode>06</RegionCode>     <RegionName>California</RegionName>     <City>Mountain View</City>     <ZipPostalCode>94043</ZipPostalCode>     <Latitude>37.4192</Latitude>     <Longitude>-122.057</Longitude>  </Location> </Locations>Problem is I want to Show data  CITY,COUNTRY,STATE in  Label .. Kindly tell me the logic .. how to read data from this XML Format ..How to Match them .. Kindly Provide me the Code , as this XML is generated by API ... Thanks a lot ..

View Complete Post

More Related Resource Links

Linq Ouery / Code / Logic for Finding Best Selling Products

Hello ExpertsPlease do reply as i am a beginner ..This is a table Named Products .. I want to show Best Selling products in a Datalist .. kindly tell me the logic for doing so by providing some examples or code by using LINQ ... Kindly help me .. [ProductId] [int] IDENTITY(1,1) NOT NULL,    [Name] [nvarchar](400) NOT NULL,    [ShortDescription] [nvarchar](max) NOT NULL,    [FullDescription] [nvarchar](max) NOT NULL,    [AdminComment] [nvarchar](max) NOT NULL,    [ProductTypeID] [int] NOT NULL CONSTRAINT [DF_Nop_Product_ProductTypeID]  DEFAULT ((1)),    [TemplateID] [int] NOT NULL,    [ShowOnHomePage] [bit] NOT NULL,    [MetaKeywords] [nvarchar](400) NOT NULL,    [MetaDescription] [nvarchar](4000) NOT NULL,    [MetaTitle] [nvarchar](400) NOT NULL,    [SEName] [nvarchar](100) NOT NULL,    [AllowCustomerReviews] [bit] NOT NULL,    [AllowCustomerRatings] [bit] NOT NULL CONSTRAINT [DF_Nop_Product_AllowCustomerRatings]  DEFAULT ((1)),    [RatingSum] [int] NOT NULL,    [TotalRatingVotes] [int] NOT NULL,    [Published] [bit] NOT NULL,    [Deleted] [bit] NOT NULL,    [CreatedOn] [datetime] NOT NULL,  

Linq query in code behind

Hii would like to figure out this LinqDataSource in code-behind in vb.net<asp:LinqDataSource                 ID="lds" runat="server"                ContextTypeName="dbDataContext"                TableName="vKommentarUnion"                  Select="new(Key, Count() as Count, It as Items)" GroupBy="themen"                 where="isdrin=0"                AutoPage="true" AutoSort="true"            /> I found only samples in C#.How can i figure it out in vb?this does not run, what is wrong? Dim db As New dbDataContext Dim kommentare = From c In db.kommentar _ Group c By c.kursid Into Group _ Select key = c.kursid, count = Group.count, _ Items = From item In Group Select item lv.DataSource = k

Format Code D0 is not working in SSRS 2008


We are trying to migrate all our RDL from SSRS 2005 to SSRS 2008.

In the rdl’s we defined format code for a  text box as “D0”  which is working fine in SQL 2005.

While migrating the rdl’s to 2008 it is not working and data is showing for that text box as “#Error”.

How to resolve this . I am having around 1000+ rdl’s to update with proper format string.

If I open the Rdl in BIDS I am getting below error.


[rsInvalidFormatString] The Format value for the textrun ‘textbox1_0_13.Paragraphs[0].TextRuns[0]’ is not valid. Format specifier was invalid.

[rsRuntimeErrorInExpression] The Value expression for

Annoying SQL exception, probably due to some OO/linq code done wrong


I started working on this "already started" project, and I'm having a really annoying error when trying to execute some interactions with SQL Server 2008:

The server failed to resume the transaction

One of these errors I get in this specific method call:

The aspx.cs Call:


busProcesso openProcess = new busProcesso(pProcessoId);
        if (openProcess.GetDocument() == null)
            //Irrelevant code.
    catch{ //... }

The Business class (relevant part):
public class busProcesso : IbusProcesso
        public Processo vProcesso { get; set; }

        RENDBDataContext db;

        public busProcesso()
            vProcesso = new Processo();

        public busProcesso(decimal pProcessoId)
            db = new RENDBDataContext();
                 vProcesso = db.Processos.SingleOrDefault(x => x.Id == pProcessoId);
            catch (Exception ex)
                throw new Exception(ex.Message, ex);

        public string GetDocument()

format to Linq SQL



I need to write this: 

in Linq SQL format, does it possible? 


how can i transform this sql code into linq


i am new with linq and i wanna do something like this in linq:

SELECT  distinct t.TC_GPI_Name, t.TC_GPI_Key,  m.Drug_Name                  
FROM    TC_GPI_NAME  t inner JOIN(
									SELECT     Drug_Name, Generic_Product_Identifier
									FROM         MEDNAME
									WHERE     (Brand_Name_Code = 'T')
									GROUP BY   Drug_Name, Generic_Product_Identifier
								  ) m 
on   (left(m.Generic_Product_Identifier, 8) = left(t.TC_GPI_Key, 8))                     
where  t.tc_gpi_key like '4014306010%' and t.Record_Type = 4

how can i do this?

please correct the code (indian number format code)



The code is about place the comma's (,) i.e separator between numbers
in this format (12,21,21,123) it works good..
but when there's a decimal point such as 12345.58 it will show as 12,346.. 
it will round up the values.. ( which i dont want that .. i want as it value to be printed )
and one more problem  if there five digit with two decimal i.e(12345.00) it will show correct
i.e (12,345.00) but if i there four digit with two decimal i.e(1234.00 ) it will show this #error

how to use autocomplete in Textbox using LINQ code


Hi Everyone!


I'm a newbie in C# then i want to know about my concerns in textbox autocomplete from database using LINQ. Can u cite me an example on how to code it and where should I place it? Is it in Form_Load or Textbox_TextChange?


Tnx man and more power!

If or Case in a LINQ SQL code, How to Use Count() Request.QueryString("imageidentity")



If i want to get some diffrent data from a DB
and its by using Request.QueryString("SortBy")

What do u use !?
If The Else or Case !?

What i want is that if SortBy in the Url link is NameUP, then its sorts by A, B C and so on
and if NameDown then the other way.

Im using this LINQ code.

    Public Sub linqdb()

        Dim DBconn As New GetProductListDataContext()
        Dim Q = _
        From p In DBconn.GetTable(Of Product)() _
        Where p.IsEnabled = "1" _
             Order By p.PName Descending _
        Select p
        Dim L = Q.ToList
        MyRep.DataSource = Q
        PValue.Text = L.Count().ToString()

    End Sub

 How do i also get this code to Count the outgoing records !?
I cant get any number from PValue.Text = L.Count().ToString()
from my CB to my .ASPX site with a <asp:Label ....

How to format my SQL Code in Management Studio 2008

I have installed Sql Server 2008 management studio,  and I want to use sql editor for formatting my sql code. for example. I have wrote this code as follow: always more
create table mytestTable ( myId int primary key, myCode varchar(20) not null, myValue varchar(100))
and it is hard to read. and I want to format my code as follow
create table mytestTable
      myId int primay key,
      myCode varchar(20) not null,
      myValue varchar(100)

I follow this step:
1:right click on toolbar and select customize
2:chose edit and find document format button in right box.
3:type my code in sql editor and finish it. but the "format the whole document " button is disalbe. so I can't to format my code.

thanks and best regard.
yours chalin
Although my hair is Chaotic.

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Playing with Linq grouping: GroupByMany?

One of its features is grouping. Many people understand grouping like it is defined in Sql. Linq is implementing grouping quite the same way. Let's discover this syntax and how to make consecutive groups easier.

LINQ : Implementing IN and NOT IN

I got tried of typing

var result = from s in source
where items.Contains(s)
select s;and so I implemented the IN and NOT IN methods as extension methods:

101 LINQ Samples Tutorials

101 LINQ Example with sample code snippets....This sample prints each element of an input integer array whose value is less than 5. The sample uses a query expression to create a new sequence of integers and then iterates over each element in the sequence, printing its value

Free Code Snippets - ASP.NET

You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

Free C# Code Snippets

Linq: how to share parameters between lambda expressions ?

When using Linq to objects, you will quickly feel the need to pass some parameters from a method to another but it's not so easy because each Linq method is not calling the following one. In a Linq sequence, each method is using the result computed by the previous one. So, local contexts are not visible from one method to another.
The compiler is using two technical different ways to let parameters go out of a method.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend