Re: HttpWebRequest/Response problem - HELP

From: Pete Davis (pdavis68_at_hotmail.com)
Date: 02/29/04


Date: Sun, 29 Feb 2004 13:26:43 GMT

I assume an exception is being thrown in the app. What is the exception?

Pete

-- 
http://www.petedavis.net
"Taryon" <taryon@fluxwire.com> wrote in message
news:eB7CLAs$DHA.2040@TK2MSFTNGP12.phx.gbl...
> Hi All!
>
> i have an handler to save some informations on the database. works very
> fine. well. i change the sql INSERT string to include a new item. Now im
> getting an INTERNAL SERVER ERROR - 500. and even i change to old code i
> still have the error.
>
>
>
> This is the client code.
> HttpWebRequest req1 =
> (HttpWebRequest)WebRequest.Create(serverUrlTextbox.Text);
> req1.Method = "PUT";
> req1.AllowWriteStreamBuffering = true;
> Stream reqS = req1.GetRequestStream();
> StreamWriter wrtr1 = new StreamWriter(reqS);
> wrtr1.WriteLine("AGENT=5555");
> wrtr1.WriteLine(DateTime.Now.ToShortDateString());
> wrtr1.WriteLine(DateTime.Now.ToShortTimeString());
> wrtr1.WriteLine("*");
>
> for (int i = 0; i < 3; i++)
> {
> wrtr1.WriteLine("information");
> }
> wrtr1.Close();
>
>
>
> // Submit the request and get the response object
> HttpWebResponse resp1 = (HttpWebResponse) req1.GetResponse();
> // Retrieve the response stream and wrap in a StreamReader
> Stream respStream1 = resp1.GetResponseStream();
> StreamReader rdr1 = new StreamReader(respStream1);
> // Read through the response line-by-line
> string inLine1 = rdr1.ReadLine();
> rdr1.Close();
> }
>
> ==================================
>
> This is the Handler code
>
> // Read the incoming data
> inLine=codes[1];
> //sw.WriteLine("agente");
> string sqla="INSERT INTO CHARGES(AGENT, DATAOCORRENCIA, HORAOCORRENCIA)
> VALUES (";
> string pvez="'";
> while (inLine != null)
> {
> sqla+=pvez+inLine+"'";
> inLine = rdr.ReadLine();
> pvez=",'";
> if (inLine=="*") break;
> }
> sqla+=")";
> //sw.WriteLine(sqla);
> OdbcCommand cmd1 = new OdbcCommand(sqla,conn);
> cmd1.ExecuteNonQuery();
> OdbcCommand cmdx = new OdbcCommand("SELECT @@IDENTITY", conn);
> long nId = Convert.ToInt64(cmdx.ExecuteScalar());
> inLine = rdr.ReadLine();
> string sql3="";
> while (inLine != null)
> {
> sql3="INSERT INTO ALLCUST(CHARGE, ENQUADRAMENTO) VALUES
> ("+nId.ToString()+",'"+inLine+"')";
> OdbcCommand cm = new OdbcCommand(sql3,cnn);
> cm.ExecuteNonQuery();
> inLine=rdr.ReadLine();
> }
> wrtr.WriteLine("fim");
> wrtr.Flush();
>
> ========================
>
> I receive the error in this line of the client code.
>
> // Submit the request and get the response object
> HttpWebResponse resp1 = (HttpWebResponse) req1.GetResponse();
>
> PS. this is the code that was working before. The change that i did was a
> new line writed in the client code and a new item in the select server
code.
>
>
>
>
>


Relevant Pages

  • Re: Question about design, defmacro, macrolet, and &environment
    ... "Expects to find the literal string on the stream." ... (defun send (string &optional stream) ... (declaim (inline make-adjustable-string)) ...
    (comp.lang.lisp)
  • HttpWebRequest/Response problem - HELP
    ... i have an handler to save some informations on the database. ... i change the sql INSERT string to include a new item. ... // Retrieve the response stream and wrap in a StreamReader ... inLine = rdr.ReadLine; ...
    (microsoft.public.dotnet.languages.csharp)
  • [PATCH 1/2] cifs: little cleanups for cifs_unicode.h - functions and comments
    ... Concatenate the second string to the first ... -static inline wchar_t * ... +/* UniStrcat: Concatenate the second string to the first ... +static inline int UniStrcmp ...
    (Linux-Kernel)
  • Re: Strange problem when not in debugger
    ... private string huidigWeb; ... int buffLength = 2048; ... // Opens a file stream to read the file to be uploaded ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ReplacerStream
    ... string, do a replace on that string and create a stream again to be ... If those are problems, and you are looking just for a single string, it seems to me that you could just read the stream one character at a time, checking to see if it matches the current character in your search string. ...
    (microsoft.public.dotnet.framework)

Loading