How can I solve this error "XML Parsing Error: no element found"

 heres my code behind in UploadImage.aspx.vb


Imports System.Data.SqlClient
Imports System.Configuration
Imports System.IO
Partial Class UploadImage
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim conn As New SqlConnection
        Dim comm As New SqlCommand
        Dim connStr As String

        connStr = ConfigurationManager.ConnectionStrings("TESDA").ConnectionString
        conn = New SqlConnection(connStr)
        comm = New SqlCommand("Insert into TImage (CategoryName,Picture,MimeType) VALUES (@name,@pic,@type)", conn)
        'gi convert and image to byte array
        Dim data(FileUpload1.PostedFile.ContentLength - 1) As Byte
        FileUpload1.PostedFile.InputStream.Read(data, 0, FileUpload1.PostedFile.ContentLength)

        comm.Parameters.Add("name", System.Data.SqlDbType.Text)
        comm.Parameters("name").Value = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName).ToLower

        comm.Parameters.Add("pic", System.Data.SqlDbType.Image)
        comm.Parameters("pic").Value = data

        comm.Parameters.Add("type", System.Data.SqlDbType.NChar)
        comm.Parameters("type").Value = FileUpload1.PostedFile.ContentType

        If FileUpload1.HasFile = True Then
                Label1.Text = "Successfully uploaded"

            End Try

        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
    End Sub
End Class


then here my code behind in Image.aspx.vb


Imports System.Data.SqlClient
Imports System.Configuration
Partial Class image
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim conn As New SqlConnection
        Dim comm As New SqlCommand
        Dim connStr As String
        Dim reader As SqlDataReader
        Dim dataBuffer() As Byte
        connStr = ConfigurationManager.ConnectionStrings("TESDA").ConnectionString
        conn = New SqlConnection(connStr)
        comm = New SqlCommand("Select * from  TImage where no = @no", conn)

        comm.Parameters.Add("no", System.Data.SqlDbType.Int)
        comm.Parameters("no").Value = 5
        reader = comm.ExecuteReader

        Response.AddHeader("Content-type", reader("CategoryName"))
        Response.AddHeader("Content-type", reader("MimeType"))
        Dim blen As Integer = CType(reader("picture"), Byte()).Length

        dataBuffer = reader("Picture")

        Response.OutputStream.Write(dataBuffer, 0, blen)
    End Sub
End Class


 When I am going to call the Image.aspx it always prompt this error:

XML Parsing Error: no element found
Location: http://localhost:4730/tesdaweb/UploadImage.aspx
Line Number 1, Column 1:

Is there something wrong in my codes...

Please help


11/13/2007 5:40:56 PM 29906 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 40

Try setting MaintainScrollPositionOnPostback in page directive to false.

11/13/2007 6:17:31 PM

Similar Artilces:

Getting "XML Parsing Error: no element found" even when no code is in form!
I published a default.aspx webform to IIS 6 and got the great error message:XML Parsing Error: no element foundLocation: http://Courses/test/survey.aspxLine Number 1, Column 1: I have no extra code in this page, it's just the page that visual studio 2008 creates when starting a new web application project. It's worked fine forever. The only "change" that's happened on the server was a software installation of the Oracle Database 11g Release 1 Client and Oracle Developer Tools for Visual Studio. I also had the server admin set some environment variables.  Has a...

"Error parsing command" error
Let me first say that I am NOT refering to the problem in the IDE where this error can occur. This is different (yet similar) error that occurs at runtime when using SQLDA. I am using PB8 (9066) and Oracle 8.1.7. It seems whenever an inline view (a SELECT in the FROM clause) occurs in a type 4 dynamic sql - PB8 just can't handle it. This works fine in PB7, but this simple example below will fail : Sqlstatement = "select 1 as COL from ( select 1,2,3 from dual)" PREPARE SQLSA FROM :Sqlstatement ; DESCRIBE SQLSA INTO SQLDA ; DECLARE my_cursor DYNAMIC CURSOR FOR...

superreview requested: [Bug 251274] Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line:
Boris Zbarsky <> has asked <> for superreview: Bug 251274: Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line: 684"] Attachment 193251: Fix ------- Additional Comments from Boris Zbarsky <> This just makes su...

superreview granted: [Bug 251274] [FIX]Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Lin <> has granted Boris Zbarsky <>'s request for superreview: Bug 251274: [FIX]Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line: 684"] Attachment 193251: Fix ------- Additional Comments from <neil.parkwa...

"There was an error generating the XML document" error
Using PB10.5.2 Build 7016 Generated proxies for Web Service using .NET (not EasySoap) Most functions work, but getting this error when calling a particular function whose 1st parameter is a complex datatype (which PB converts to structure) consisting of other complex data types (which PB converts to structures). The function is: SetTerminalsApplicationCharacteristics ( ggws_fwMTSetAppCharacteristics AppCharacteristics, string terminals[] ) returns ggws_sendmessageresponses ggws_fwMTSetAppCharacteristics has 17 fields that are structures. Each of these structures has 2-5 fields ...

error "server found, but communication error"
Hi all, since about two weeks the server stops sometimes communications with new clients (ODBC, ISQL, Sybase Central). The clients which are logged in can continue to work. After I restart the server everythings is fine ... until the next error. Can you give me a hint where to look for? Thanks Michael Sybase Adaptive Server Anywhere Network Server Version on Windows 2000 SP4 Sybase Central with plug-in Adaptive Server Anywhere 8 ODBC driver: Adaptive Server Anywhere 8.0 Version Michael, Have you captured the error ...

"Error Group: WINSOCK" "Error Code:11004"
Hi Just setup iPrint on the server and tried to install the printer to the laptop and got the following message: Error code:11004 Error message: Winsock 11004 - The DNS name has been found in the database, but its associated data is not correct. Error group: WINSOCK Error code:11004 Anyone know what associated data it is referring to? Thanks in advance -- iangh2 A quick Google found this on WSANO_DATA (11004) Valid name, no data record of requested type Berkeley description: The requested name is valid, but does not hav...

upgrade error:"CONNECTIVITY ERROR:DB-Library: "SQL Server connection timed out."
PLEASE HELP OH WISE SYBASE GURUS! upgrading 11.9.2 to 12.0. unloaded software. rebooted server. selected "upgrade server" in Configure Sybase Servers window. typed in sa password. got "CONNECTIVITY ERROR: DB-Library: "SQL Server connection timed out." -- Chuck Boyce Yahoo Messenger ID: chuck_boyce_jr AOL Instant Messenger ID: sg95m476 ICQ Messenger ID: 41449031 ...

Error found "Access to the path "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Viewers" is denied. "
Hi guys! i'm trying to solve the error "Err Msg: "Object reference not set to an instance of an object" in ASP.NET app" but when i followed the instructions in the link, this error appeared ""Access to the path "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Viewers" is denied. " What's going on? i already went to the iis to add new virtual directory (CrystalReportWebFormViewer) but different error appeared when i compile and browse my application. pls help ...

SQL error: java.sql.SQLException: Column "-n/a-" not found
Good Morning, I am getting the above SQL error when I define a new variable in my select statement. This syntax did not generate an error message in the V9 beta release. Is this select syntax no longer permitted? Or am I missing some other issue? The error message occurs on new variables in the select regardless of the db element being the index. The error message ceases if I remove the "nextid" verbage from the select. Entire text of code and command winow output are below. Thanks much for your input, and thanks (belatedly) for your input on my previous post. Ca...

"The resource cannot be found." error when there is a "dot" at the end of the url
Hi,I'm using ASP .NET MVC Beta and I get the HTTP 404 (The resource cannot be found) error when I use this url which has a "dot" at the end:  http://localhost:81/Title/Edit/Code1.If I remove the dot at the end or the dot is somewhere in the middle I don't get the error. Error details are as follows:I tried to debug but it I get the error from "System.Web.CachedPathData.GetConfigPathData(String configPath)" before ProcessRequest in MvcHandler.Is "dot" not allowed at the end of a url? Or is there a way to fix the route definition to handle this url?Th...

Spidermonkey as a javascript parser. error is "parse error in file"
Hello I want to use spidermonkey as a JavaScript parser.I could successfully compile the parser program. gcc -DXP_UNIX -I/usr/local/include/spidermonkey -o parser parser.c -L/usr/local/lib -ljs -lm While running i got the error:error while loading shared libraries: cannot open > shared object file: No such file or directory and corrected by setting the LD_LIBRARY_PATH environment variable. Then I have given the JavaScript for parsing it gives "parse error in file". ../parser var x, y; x = 1; y = x * 2; "parse error in file". can anyon...

How can I fix "Compiler Error Message: CS0433" Error?
Hello, I have wrote a class in app code. But whenever I try to load that class it gives me that error. For the beginning it has occured only in some pages of my project, but since I cleared my C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files folder it showed in all of my pages. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Messag...

Operating system error 5: "5(error not found)"
Im getting an error when I go to load a page after editing (adding extra tables) the aspnetdb database (in both firefox and IE), Visual Web Developer sees the database when I want to edit it and have no problems playing with it, it is just when I go to load the page that im getting a problem, if I delete the aspnetdb.mdf and aspnetdb.ldf files from the App_Data folder and load a page there is not a problem but i need to access these extra tables, im running vwd beta2 and sql express beta 2. There is also no problem when using the "Website->ASP.NET Configuration" app to add new us...

Web resources about - How can I solve this error "XML Parsing Error: no element found" -

resources last updated: 11/20/2015 6:42:38 PM