473,739 Members | 7,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: Input string not in correct format

Input string not in correct format
--------------------------------------------------------------------------------
I am trying to view a picture from a table. I am getting this error
Input string not in the correct format.
Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.FormatEx ception: Input string was not in a
correct format.

Source Error:
Line 45: cmdGetFile.Para meters("@Attach mentID").Value =
Request("Attach mentID").ToStri ng
Line 46: dbconn.Open()
Line 47: dr = cmdGetFile.Exec uteReader
Line 48: If dr.Read Then
Line 49: Response.Conten tType = dr("ContentType ").ToString

Source File: d:\inetpub\wwwr oot\viewpicture s\ViewAttachmen t.aspx.vb
Line: 47

Stack Trace:
[FormatException : Input string was not in a correct format.]
System.Data.Sql Client.SqlComma nd.ExecuteReade r(CommandBehavi or
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.Sql Client.SqlComma nd.ExecuteReade r()
Computers_Net.V iewAttachment.P age_Load(Object sender, EventArgs e)
in d:\inetpub\wwwr oot\viewpicture st\ViewAttachme nt.aspx.vb:47
System.Web.UI.C ontrol.OnLoad(E ventArgs e)
System.Web.UI.C ontrol.LoadRecu rsive()
System.Web.UI.P age.ProcessRequ estMain()

Any help will be appreciated
Thanks in advance
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 19 '05 #1
5 2511
The error is likely with your commandText which you didn't show up (the
actual SELECT)

Alternatively, Request("Attach mentId") might be null...but I doubt that...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"blackg" <ea*******@hotm ail-dot-com.no-spam.invalid> wrote in message
news:42******** **@127.0.0.1...
Input string not in correct format
-------------------------------------------------------------------------- ------ I am trying to view a picture from a table. I am getting this error
Input string not in the correct format.
Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.FormatEx ception: Input string was not in a
correct format.

Source Error:
Line 45: cmdGetFile.Para meters("@Attach mentID").Value =
Request("Attach mentID").ToStri ng
Line 46: dbconn.Open()
Line 47: dr = cmdGetFile.Exec uteReader
Line 48: If dr.Read Then
Line 49: Response.Conten tType = dr("ContentType ").ToString

Source File: d:\inetpub\wwwr oot\viewpicture s\ViewAttachmen t.aspx.vb
Line: 47

Stack Trace:
[FormatException : Input string was not in a correct format.]
System.Data.Sql Client.SqlComma nd.ExecuteReade r(CommandBehavi or
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.Sql Client.SqlComma nd.ExecuteReade r()
Computers_Net.V iewAttachment.P age_Load(Object sender, EventArgs e)
in d:\inetpub\wwwr oot\viewpicture st\ViewAttachme nt.aspx.vb:47
System.Web.UI.C ontrol.OnLoad(E ventArgs e)
System.Web.UI.C ontrol.LoadRecu rsive()
System.Web.UI.P age.ProcessRequ estMain()

Any help will be appreciated
Thanks in advance
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 19 '05 #2
Thank you Karl for your response:
Here is my SqlCommandText:

SELECT FileSize, FileName, FileData, ContentType
FROM tblAttachments WHERE (AttachmentID = @AttachmentID)

Thanks in advance
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 19 '05 #3
Doesn't seem to be anything wrong with that...

I'd go with my other guess than, Request("Attach mentId") is null or some
invalid value...you should take a quick look at it to see

Also, i suspect that the parameter is being loaded something like:

cmdGetFile.Para meters.Add("@At tachmentID", SqlDbType.Int)

or something?

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"blackg" <ea*******@hotm ail-dot-com.no-spam.invalid> wrote in message
news:42******** **@127.0.0.1...
Thank you Karl for your response:
Here is my SqlCommandText:

SELECT FileSize, FileName, FileData, ContentType
FROM tblAttachments WHERE (AttachmentID = @AttachmentID)

Thanks in advance
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 19 '05 #4
So how should the code look like?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 19 '05 #5
What code?

On 10 Mar 2005 15:36:45 -0600,
ea*******@hotma il-dot-com.no-spam.invalid (blackg) wrote:
So how should the code look like?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com


--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
21136
by: Jim | last post by:
im using asp.net, C# to enter data into a table in sql server...however im getting this error: Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format.
0
768
by: lianfe_ravago | last post by:
Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format. Source Error: Line 457: <tr>
1
6146
by: keithb | last post by:
I have a command button in GridView row that fires the RowCommand Event when clicked. The event handler looks like this: protected void grid_RowCommand(Object sender, GridViewCommandEventArgs e) { int rowIndex = Convert.ToInt32(e.CommandArgument); When this code runs it triggers an "Input string was not in a correct format" error.
0
2543
by: hudhuhandhu | last post by:
have got an error which says Input string was not in a correct format. as follows.. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format. Source Error: Line 237: Dim validNow As Integer = 1 Line...
1
7424
by: redpayne | last post by:
Okay, I finally got this program to run according to what the book had us build it as. Now prof wants case 2 and case 3 to prompt again for input, check input to see if it is the correct type, then display a "correct" message if is correct. So, If you choose 2 from the original pane, you would be prompted to enter an integer. The program would check to see if you input an integer and if it was then you would get a "correct" message. If not...
0
11994
by: Anonieko | last post by:
Are there any javascript codes there? Answer: Yes On the PageLoad event call InitialClientControsl as follows /// <summary> /// This will add client-side event handlers for most of the form controls so
22
3268
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of seats as 0 and the flight no. is also repeating. If any can tell why is this please help me. #include<stdio.h> #include<ctype.h> #include<conio.h>
0
3163
by: sehguh | last post by:
Hiya Folks, I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005. The main page consists of an aspx page and a master page. The page also consists of a label control(hidden when run in browser). Also an Sql data source control connected to database tables for a photo album. Also label web control ID=UserIdValue. Also a Details View control ID=dvPictureInsert Problem is how to work out...
7
1171
by: Mirnes | last post by:
Hello, Can someone provide me with VB code for following C# code: Code 1: { IndexerSchedule.Install(20); }
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9479
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6054
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.