Click here to Skip to main content
15,846,091 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem registering in the access database Pin
ago248617-Mar-20 2:10
ago248617-Mar-20 2:10 
GeneralRe: problem registering in the access database Pin
Richard MacCutchan17-Mar-20 3:18
mveRichard MacCutchan17-Mar-20 3:18 
GeneralRe: problem registering in the access database Pin
ago248617-Mar-20 3:26
ago248617-Mar-20 3:26 
GeneralRe: problem registering in the access database Pin
Richard MacCutchan17-Mar-20 3:36
mveRichard MacCutchan17-Mar-20 3:36 
QuestionJava Api Callbacks crashes on dotnet framework version 4.5 and above Pin
isaketranjan16-Mar-20 1:06
isaketranjan16-Mar-20 1:06 
AnswerRe: Java Api Callbacks crashes on dotnet framework version 4.5 and above Pin
Gerry Schmitz16-Mar-20 6:05
mveGerry Schmitz16-Mar-20 6:05 
QuestionC# and ODATA CRUD communication with D365BC web service Pin
clemenslinders12-Mar-20 1:13
clemenslinders12-Mar-20 1:13 
SuggestionRe: C# and ODATA CRUD communication with D365BC web service Pin
Richard Deeming12-Mar-20 2:12
mveRichard Deeming12-Mar-20 2:12 
Rather than building the request body by hand, you should use a JSON serializer to create it.

Add a NuGet package reference to JSON.NET[^], add a using directive for the Newtonsoft.Json namespace, and change your code to:
C#
var body = new
{
    No = tbNo.Text,
    First_name = tbFirstName.Text,
    Last_Name = tbLastName.Text,
    FunctionName = tbFunctionName.Text,
};

string json = JsonConvert.SerializeObject(body);
byte[] data = Encoding.UTF8.GetBytes(json);
NB: You'll want to use the UTF8 encoding rather than ASCII, since that's what you've declared in your content-type header.

I'd also be inclined to use the HttpClient class[^] rather than the low-level HttpWebRequest class:
Call a Web API From a .NET Client (C#) - ASP.NET 4.x | Microsoft Docs[^]



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

GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
clemenslinders12-Mar-20 4:48
clemenslinders12-Mar-20 4:48 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
Richard Deeming12-Mar-20 5:29
mveRichard Deeming12-Mar-20 5:29 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
clemenslinders12-Mar-20 5:54
clemenslinders12-Mar-20 5:54 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
Richard Deeming12-Mar-20 6:43
mveRichard Deeming12-Mar-20 6:43 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
clemenslinders12-Mar-20 22:25
clemenslinders12-Mar-20 22:25 
QuestionC# code -Compare 2 pdf and give output as 2 pdfs with color Pin
Member 1476942610-Mar-20 21:13
Member 1476942610-Mar-20 21:13 
AnswerRe: C# code -Compare 2 pdf and give output as 2 pdfs with color Pin
OriginalGriff10-Mar-20 21:49
mveOriginalGriff10-Mar-20 21:49 
AnswerRe: C# code -Compare 2 pdf and give output as 2 pdfs with color Pin
Maciej Los10-Mar-20 22:25
mveMaciej Los10-Mar-20 22:25 
JokeRe: C# code -Compare 2 pdf and give output as 2 pdfs with color Pin
Richard Deeming11-Mar-20 1:37
mveRichard Deeming11-Mar-20 1:37 
GeneralRe: C# code -Compare 2 pdf and give output as 2 pdfs with color Pin
kalberts12-Mar-20 4:01
kalberts12-Mar-20 4:01 
Questiontime requirements in real-times systems? Pin
auting8210-Mar-20 4:08
auting8210-Mar-20 4:08 
AnswerRe: time requirements in real-times systems? Pin
OriginalGriff10-Mar-20 4:49
mveOriginalGriff10-Mar-20 4:49 
GeneralRe: time requirements in real-times systems? Pin
auting8210-Mar-20 5:43
auting8210-Mar-20 5:43 
GeneralRe: time requirements in real-times systems? Pin
OriginalGriff10-Mar-20 5:51
mveOriginalGriff10-Mar-20 5:51 
AnswerRe: time requirements in real-times systems? Pin
Gerry Schmitz10-Mar-20 7:30
mveGerry Schmitz10-Mar-20 7:30 
AnswerRe: time requirements in real-times systems? Pin
Richard MacCutchan10-Mar-20 8:02
mveRichard MacCutchan10-Mar-20 8:02 
Questionimport multiple csv files into msql database - C# coding - reg Pin
Member 137889379-Mar-20 8:28
Member 137889379-Mar-20 8:28 

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.