Input string was not in a correct format #3

Hi, I am running the following code and keep getting a format exception :  Input string was not in a correct format

Does anyone know why?

             GridView910.DataSourceID = SqlDataSourceSP.ID;
            
            SqlCommand command = new SqlCommand("sp910Trader", connection);
            command.CommandType = CommandType.StoredProcedure;

            command.Parameters.Add(new SqlParameter("@InqDate", SqlDbType.DateTime, 9));
            command.Parameters["@InqDate"].Value = DateFormatted;

            command.Parameters.Add(new SqlParameter("@Trader1", SqlDbType.Int, 9));
        switch(Mycasevariable)
     {
       case "Alex":
             TextBoxTraderID.Text = "10000006";
                break;
           case "David":
                TextBoxTraderID.Text = "10000009";
                break;
            case "John":
                TextBoxTraderID.Text = "10000004";
                break;
            case "Scott":
                TextBoxTraderID.Text = "10000014";

               break;

     }
            command.Parameters["@Trader1"].Value =TextBoxTraderID.Text;
            GridView910.DataBind();
            reader = command.ExecuteReader();
            reader.Read();

 

 

 

 

The stored procedure begins with the following lines :

 

 

 

 

 ALTER PROCEDURE [dbo].[sp910Trader]
    (@InqDate smalldatetime, @Trader1 int )
    AS
declare @NAV decimal
Select @NAV = EndFcNAV FROM NAV
where Created_on >= @InqDate and Created_on < DATEADD(hour, 23, @InqDate)

 

Thanks in advance. 

 

 

 

0
massoud12345
5/4/2009 5:50:20 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
637 Views

Similar Articles

[PageSpeed] 27

Maybe because you a specifying the Trader1 parameter to be an int but are passing it a string.


Steve Wellens

My blog
0
SGWellens
5/4/2009 5:56:44 PM
Reply:

Similar Artilces:

3.0.13 upgraded then HOST login nets CRITICAL ERROR..INPUT STRING..NOT IN..CORRECT FORMAT
after 3.0.13 upgrade, HOST login nets CRITICAL ERROR..INPUT STRING..NOT IN..CORRECT FORMAT Performed 3.0.13 upgrade, edited SiteSqlServer key back into Web.config.Extended pause upon loading site occurred as it should, but no expected resulting upgrade page displayed.Then after submitting login user HOST, pw, this error displays...     A critical error has occurred    Input string was not in a correct format. Dropping back to .12 dnn netted same results, so I presume db got evolved by the upgrade process above, even though no upgrade confirmation page ensue...

Input String Was not in a correct format #3
VB and ASP.net Help please. I have a web form that has a simple dropdownlist where the user selects an option. Based on that option it goes away and collects some SQL data and populates a dataset. The dataset is then bound to a datagrid on the web page and all is well. However I need to add a few columns to the datagrid and simple arithmetic expressions are ok. But I want to take a date value (end_date) out of one of my columns compare it to Now() work out the difference in months and populate a new column. But alas I get the error above. As you can probably guess by the co...

Input string was not in a correct format. #3
when I edit one Column in the datagrid. after fill 0 or 1 into one field. clicking update button.I got this error message"Input string was not in a correct format." shall I change vb code? Thanks!my vb code Sub onUpdate(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) .................................. Dim myAutoGenerate As Boolean = CType(e.Item.Cells(7).Controls(0), TextBox).Text...................................... end sub my aspx code <asp:DataGrid id="covenant_DataGrid" runat="server"" autoGenerateColumns="False"  OnUpdateCommand="onUpdate" OnCancelCommand="o...

Input string was not in a correct format. #3
 I know that this is a very general question. But I was wondering what can cause this error. System.FormatException: Input string was not in a correct format. I'm building an application that reads in a text file and then parses out the needed info to a database. Is the error reffering to my insert into statements. (It seems to be correct.) I have tried placing the parameters in quotes in the INSERT INTO statement same error.  Thanks in advance. String insertCmd = "INSERT INTO tbl ( column1, " +              &...

Input string was not in a correct format. #3
I'm doing some form validation and am getting this error.  I think it has to do with my variable assigning, but not sure.  The line that is giving my trouble is line # 24 variable "qty".  I'm assigning the value from a textBox to this variable.  qty is quantity.  So it is tested for numeric value.  Comments?1 For index As Integer = 0 To GridView1.Rows.Count - 1 2 'Programmatically access the CheckBox from the TemplateField 3 Dim cb As CheckBox = CType(GridView1.Rows(index).FindControl("ProductName"), CheckBox) 4 ...

Input string was not in a correct format. #3
Hello:  I have the following form item:<asp:dropdownlist class="formitem" id="drpperiod" runat="server"><asp:listitem text="1 Year" value="1" /><asp:listitem text="2 Years" value="2" /></asp:dropdownlist>Then I have the following code:Dim varAmount as Integer     varAmount = Convert.ToInt32(drpperiod.selecteditem.value) * 9.99It throws the following exception:Input string was not in a correct format.and highlights the above line of code, any suggestions?Need ASP.NET web hosting? Private Message me for a free quote. You are trying to store a...

Input string was not in a correct format. #3
Hi, I am trying to insert a record into 2 tables with master-child relationship. When i execute the code i get this error on the statement " UserID = Convert.ToInt32(cmdExp.ExecuteScalar())" Can anyone help? CODE AS FOLLOWS Dim con As SqlConnection Dim trans As SqlTransaction = Nothing Dim cmdExp As SqlCommand Try con = New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString) con.Open() trans = con.BeginTransaction 'CREATE THE COMMAND cmdExp = New SqlCommand() cmdExp.Connection = con cmdExp.Transaction = trans 'Create the appropriate SQL s...

(VB.net): Input string was not in a correct format.
(vb.net 1.1 -- sql server) i'm using following insert code. It is working fine when all the fields are filled but it is gives error when fields which allows null values are not filled...... i'm getting following errorVB.net): Input string was not in a correct format. plz suggest something, i'll be really thkful.                 myConn = New SqlConnection(ConfigurationSettings.AppSettings("SqlConnection.ConnectionString"))             myConn.Open()  ...

www.smcculloch.net
www.smcculloch.net is often refered to on these forums.  When I try to login to this portal I get the following error: A critical error has occurred.Input string was not in a correct format.          I guess this is a problem with Scott's portal rather then DNN, but I'd just thought I find out if anyone had any comments. (You can't comment on Scott's forum's without being logged on)   Jonathan Palmer I just tried my login and works fine. Have you cleared your cache lately? If you're a newbie, you will find lots of g...

System.FormatException: Input string was not in a correct format. #3
Is this a bug or am I going crazy??????WILL NOT WORK:     DateTime.Now.ToString("h")THIS ONE WILL THOUGH: DateTime.Now.ToString(" h")But that space gets put in front of the hour.Anything with "h" will work, as long as it's not by itself ???? Shouldn't it be "hh" ? Ben Scheirmanhttp://www.flux88.comASP.NET MVPCertified ScrumMasterASPInsiderMCSD "hh" returns the hour with a zero in front if less than 10. "h" is supposed to return the hour without the zero.DateTime.Now.ToString(" h")that works, but it won't work if the space is not in front of the h. Have you tried us...

System.FormatException: Input string was not in a correct format #3
Hi, I am trying to search a database for a username and am getting an error message saying 'System.FormatException: Input string was not in a correct format'.  This code works when searching for a username that is NOT in the database (I get the confirmation message), but when the username IS in the database, I get the above error.  Would anyone be able to kindly shed some light on where I am going wrong?  My code is; using System; using System.Collections; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using ...

Web resources about - Input string was not in a correct format #3 - asp.net.sql-datasource

Correct name (botany) - Wikipedia, the free encyclopedia
If there are two or more legitimate names for the same taxon (with the same circumscription, position and rank), then the correct name is the ...

Facebook Corrects Bug That Exposed Email Addresses, Phone Numbers Of Some 6M Users
The good news: The Facebook Security team snuffed out a bug that exposed some 6 million Facebook users’ email addresses and phone numbers. The ...

Present and Correct (@presentcorrect) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Perspective Correct for iPhone, iPod touch, and iPad on the iTunes App Store
Get Perspective Correct on the App Store. See screenshots and ratings, and read customer reviews.

Using the correct terms - Flickr - Photo Sharing!
Today’s Office OFFline comic was inspired by "Facebook Reverts Terms of Service After Complaints" (http://www.insidefacebook.com/2009/02/18/ ...

DA Mike Ramos Speaks Out in Support of Law Enforcement and Corrects Jon Stewart of The Daily Show - YouTube ...
On Monday, December 1, 2014, Jon Stewart of The Daily Show incorrectly stated that officers shot Dante Parker—using this local incident to fuel ...

Usada ‘immediately correct the false suggestion’ relating to Floyd Mayweather doping claims
Floyd Mayweather received an injection of saline and vitamins on the eve of his superfight against Manny Pacquiao, the United States Anti-Doping ...

We're not a 'politically correct circle-jerk': UC Confessions Facebook page defend actions after racist ...
Anonymous Facebook group designed for students at the University of Canberra apologises for publishing racist image - but only because it turned ...

Jack Viney decision 'probably correct': AFL football operations manager Mark Evans
... bump remains an ongoing one, but the final decision of the AFL appeals board to overturn Jack Viney's two-match suspension was "probably correct" ...

ANZ corrects AFR on dividend, tax - HeraldSun Search Search
ANZ Bank today confirmed that it expected to fully frank dividends for the foreseeable future.

Resources last updated: 12/15/2015 6:16:21 AM