display data from database pertikular format using wcf service?

Posted by Mandlaa under WCF on 10/2/2014 | Points: 10 | Views : 695 | Status : [Member] | Replies : 7
I  am creating one Stored procedure alog with 3 tables retrieving data from database,

at the time of displaying data not displying correct format







Responses

Posted by: Mandlaa on: 10/2/2014 [Member] Starter | Points: 25

Up
0
Down
I am running this code getting data from database also display data like below,




I want above type of output how can i do this one plz help me


Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 10/2/2014 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Please explain your problem clearly so we can help

Thank you for posting at Dotnetfunda
[Administrator]

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mandlaa on: 10/3/2014 [Member] Starter | Points: 25

Up
0
Down
My implementation code

public List<ShipperLoadStatus> AllLoadstatus(int loadid)

{

List<ShipperLoadStatus> lists = new List<ShipperLoadStatus>();

/
SqlConnection con = new SqlConnection(@"Data Source=ASHDEVBTS-1;Initial Catalog=Sampath;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Clear();
cmd.CommandText = "Select_sta";
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
ShipperLoadStatus sh = new ShipperLoadStatus();
sh.LEAN_LOAD_ID = Convert.ToInt32(dr["LEAN_LOAD_ID"]);
sh.PST_STATUS_TYPE = Convert.ToString(dr["PST_STATUS_TYPE"]);
sh.TRIPNUM = Convert.ToString(dr["TRIPNUM"]);
sh.DLULOAD = Convert.ToString(dr["DLULOAD"]);

sh.ND = Convert.ToString(dr["ND"]);
sh.STOP_SEQUENCE = Convert.ToString(dr["STOP_SEQUENCE"]);
sh.CMP_ID = Convert.ToString(dr["CMP_ID"]);
sh.DUE_DATE_START = Convert.ToDateTime(dr["DUE_DATE_START"]);
sh.DUE_DATE_END = Convert.ToDateTime(dr["DUE_DATE_END"]);
sh.PLAN_DEST_DRIVER_ID = Convert.ToString(dr["PLAN_DEST_DRIVER_ID"]);
sh.PLAN_DEST_TRL_DISPLAY = Convert.ToString(dr["PLAN_DEST_TRL_DISPLAY"]);
var data = new ShipperLoadStatus(){LoadID=sp.LoadID,,
stopUpdates = new List<StopUpdate>{new StopUpdate(){STOP_SEQUENCE=st.STOP_SEQUENCE,STOPTYPE=st.STOPTYPE,DUE_TIMEZONE=st.DUE_TIMEZONE,
DUE=st.DUE,ENDDUE=st.ENDDUE,ACTUALARRIVAL_TIMEZONE=st.ACTUALARRIVAL_TIMEZONE,ACTUALARRIVAL=st.ACTUALARRIVAL,
ACTUALDEPART_TIMEZONE=st.ACTUALDEPART_TIMEZONE,ACTUALDEPART=st.ACTUALDEPART}
}
};

lists.Add(data);
}
return lists.ToList();
}

I am running getting output like this code,i am getting output like this,matching one Loadid value
<?xml version="1.0" encoding="UTF-8"?>


-<ShipperLoadStatu batchref="LS-56273-260449.xml" created="201405281117" xmlns="ShipperLoadStatus.xsd">


-<ShipperLoadStatus>

<LoadID>12345678</LoadID>

-<StopUpdate>

<StopType>Pick</StopType>

<StopNum>1</StopNum>

<Due TimeZone="ZZZ">05/28/2014 08:00</Due>

<EndDue TimeZone="ZZZ">05/28/2014 16:00</EndDue>

<ActualArrival TimeZone="ZZZ">05/28/2014 10:32 </ActualArrival>

<ActualDepart TimeZone="ZZZ">05/28/2014 11:14</ActualDepart>

</StopUpdate>


</ShipperLoadStatus>


Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mandlaa on: 10/3/2014 [Member] Starter | Points: 25

Up
0
Down
in my table loadid same value in two rows,in that situation,i want to display data like this,
<?xml version="1.0" encoding="UTF-8"?>

-<ShipperLoadStatu batchref="LS-56273-260449.xml" created="201405281117" xmlns="ShipperLoadStatus.xsd">


-<ShipperLoadStatus>

<LoadID>12345678</LoadID>

-<StopUpdate>

<StopType>Pick</StopType>

<StopNum>1</StopNum>

<Due TimeZone="ZZZ">05/28/2014 08:00</Due>

<EndDue TimeZone="ZZZ">05/28/2014 16:00</EndDue>

<ActualArrival TimeZone="ZZZ">05/28/2014 10:32 </ActualArrival>

<ActualDepart TimeZone="ZZZ">05/28/2014 11:14</ActualDepart>

</StopUpdate>

-<StopUpdate>

<StopType>Delivary</StopType>

<StopNum>2</StopNum>

<Due TimeZone="ZZZ">05/2/2014 08:00</Due>

<EndDue TimeZone="ZZZ">05/22/2014 16:00</EndDue>

<ActualArrival TimeZone="ZZZ">05/31/2014 10:32 </ActualArrival>

<ActualDepart TimeZone="ZZZ">05/12/2014 11:14</ActualDepart>

</StopUpdate>



</ShipperLoadStatus


The condition how many times execute based on LoadId that many times get values and display

in

StopUpdate vales
can you please give me the idea about that one

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mandlaa on: 10/3/2014 [Member] Starter | Points: 25

Up
0
Down
please help me

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mandlaa on: 10/6/2014 [Member] Starter | Points: 25

Up
0
Down
give me the solution for this one,please

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mandlaa on: 10/6/2014 [Member] Starter | Points: 25

Up
0
Down
plz help me,argent

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response