Click here to Skip to main content
15,175,960 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# How to use place holder in string variable Pin
Mou_kol19-Nov-21 5:03
MemberMou_kol19-Nov-21 5:03 
AnswerRe: C# How to use place holder in string variable Pin
BillWoodruff19-Nov-21 18:00
mveBillWoodruff19-Nov-21 18:00 
GeneralRe: C# How to use place holder in string variable Pin
Mou_kol16-Dec-21 7:31
MemberMou_kol16-Dec-21 7:31 
GeneralRe: C# How to use place holder in string variable Pin
Mou_kol16-Dec-21 7:32
MemberMou_kol16-Dec-21 7:32 
QuestionAsp.net web api(GET) to pull the records(8 lac records) Pin
Sai Kumar18-Nov-21 5:43
MemberSai Kumar18-Nov-21 5:43 
AnswerRe: Asp.net web api(GET) to pull the records(8 lac records) Pin
Richard Deeming18-Nov-21 5:47
mveRichard Deeming18-Nov-21 5:47 
GeneralRe: Asp.net web api(GET) to pull the records(8 lac records) Pin
Sai Kumar18-Nov-21 6:06
MemberSai Kumar18-Nov-21 6:06 
GeneralRe: Asp.net web api(GET) to pull the records(8 lac records) Pin
Richard Deeming18-Nov-21 6:24
mveRichard Deeming18-Nov-21 6:24 
Your Getlocationdetails method is currently loading everything into a DataSet. You would need to use a SqlDataReader instead, and write the records to the response as you read them.

Something like this:
C#
public async Task<HttpResponseMessage> GetLocation([FromBody] data data)
{
    return new HttpResponseMessage(HttpStatusCode.OK)
    {
        Content = new PushStreamContent(async (outputStream, httpContext, transportContext) =>
        {
            using (var sw = new StreamWriter(stream))
            using (var jsonWriter = new JsonTextWriter(sw))
            using (SqlConnection connection = CreateConnection())
            using (SqlCommand command = new SqlCommand("...", connection))
            {
               ... ADD PARAMETERS HERE ...
               
                await connection.OpenAsync();
                using (var reader = await command.ExecuteReaderAsync())
                {
                    if (!reader.HasRows)
                    {
                        var serializer = new JsonSerialize();
                        serializer.Serialize(writer, new { status = "Success", message = "No rows to return" });
                        return;
                    }
                    
                    writer.WriteStartArray();
                    while (await reader.ReadAsync())
                    {
                        writer.WriteStartObject();
                        writer.WritePropertyName("name");
                        writer.WriteValue(reader["name"]);
                        writer.WritePropertyName("order");
                        writer.WriteValue(reader["order"]);
                        writer.WritePropertyName("date");
                        writer.WriteValue(reader["date"]);
                        ...
                        writer.WriteEndObject();
                    }
                    writer.WriteEndArray();
               }
            }
        })
    };

}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Asp.net web api(GET) to pull the records(8 lac records) Pin
Sai Kumar18-Nov-21 6:38
MemberSai Kumar18-Nov-21 6:38 
QuestionTrouble using Canon's EDSDK in VS on mac Pin
Member 1543145718-Nov-21 5:19
MemberMember 1543145718-Nov-21 5:19 
AnswerRe: Trouble using Canon's EDSDK in VS on mac Pin
Luc Pattyn18-Nov-21 5:55
sitebuilderLuc Pattyn18-Nov-21 5:55 
QuestionC sharp Picturebox linking error Pin
ÖmürTokman9-Nov-21 0:05
MemberÖmürTokman9-Nov-21 0:05 
AnswerRe: C sharp Picturebox linking error Pin
OriginalGriff9-Nov-21 0:27
mveOriginalGriff9-Nov-21 0:27 
GeneralRe: C sharp Picturebox linking error Pin
ÖmürTokman9-Nov-21 1:09
MemberÖmürTokman9-Nov-21 1:09 
GeneralRe: C sharp Picturebox linking error Pin
OriginalGriff9-Nov-21 1:17
mveOriginalGriff9-Nov-21 1:17 
AnswerRe: C sharp Picturebox linking error Pin
Richard MacCutchan9-Nov-21 0:39
mveRichard MacCutchan9-Nov-21 0:39 
GeneralRe: C sharp Picturebox linking error Pin
ÖmürTokman9-Nov-21 1:13
MemberÖmürTokman9-Nov-21 1:13 
AnswerRe: C sharp Picturebox linking error Pin
Eddy Vluggen10-Nov-21 4:06
professionalEddy Vluggen10-Nov-21 4:06 
Questionwriting content of csv files into oracle Pin
md arif 20215-Nov-21 0:27
Membermd arif 20215-Nov-21 0:27 
AnswerRe: writing content of csv files into oracle Pin
Richard MacCutchan5-Nov-21 1:34
mveRichard MacCutchan5-Nov-21 1:34 
AnswerRe: writing content of csv files into oracle Pin
OriginalGriff5-Nov-21 2:30
mveOriginalGriff5-Nov-21 2:30 
GeneralRe: writing content of csv files into oracle Pin
Richard MacCutchan5-Nov-21 3:09
mveRichard MacCutchan5-Nov-21 3:09 
QuestionDerived Treeview override not being called at all. Pin
pr1mem0ver4-Nov-21 4:47
Memberpr1mem0ver4-Nov-21 4:47 
AnswerRe: Derived Treeview override not being called at all. Pin
Richard Deeming4-Nov-21 5:01
mveRichard Deeming4-Nov-21 5:01 
GeneralRe: Derived Treeview override not being called at all. Pin
primem0ver4-Nov-21 6:17
Memberprimem0ver4-Nov-21 6:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.