What Should The Int Size Be For A Int32 In A CMD Parameter
Feb 8, 2011What should the int size be for a Int32 in a CMD parameter
[Code]....
What should the int size be for a Int32 in a CMD parameter
[Code]....
I'm using a GridView control to edit data in a MySQL database.
I've created the C# code behind but I'm having trouble pulling back the parameter from a radiobutton control to populate an Int32 field in the database. I'm getting "Input string not in correct format"This is the particular bit (amongst a host of others of the same type) that is causing the problem:
cmd.Parameters.Add("?yes", OdbcType.Int).Value = (Convert.ToInt32(((RadioButton)GridView2.Rows[i].FindControl("edYes")).Text));
I am not sure where my app is failing but most probably this is where it is failing.. I think lblExpID.Text is the culprit. Here's the relvant part of my code:
Dim lblExpID As Label
For Each item In LSGrid.Rows
lblExpID = item.FindControl("lblID")
If txtExpGenFund.Text <> "" Then
sqlArray(i) = ExpDetailsID & "," & (lblExpID.Text) & "," & MunID & "," & _
Val(txtExpGenFund.Text) & "," & Val(txtExpDetSpecialRevenue.Text) & "," & _
Val(txtExpDetCapitalProjects.Text) & "," & expTotal & "," & reportingYear & "," & "Test Comments" & "," & UserID
End If
Can u help me identify why i am getting this error looking at the sp below:
PROCEDURE [dbo].[uspEXPENDITURE_DETAILS]
(
@ExpDetailsID int=0 output,
@ExpDet_ExpID int,
@ExpDet_Municipality_ID nvarchar(50),
@ExpDetGeneralFund money,
@ExpDetSpecialRevenue money,
@ExpDetCapitalProjects money,
@ExpDetTotal money,
@Exp_Reporting_Year varchar(10),
@ExpComments varchar(max),
@Contact_ID int
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
delete from [dbo].[TBL_EXPENDITURE_DETAILS] where ExpDet_ExpID=@ExpDet_ExpID and ExpDet_Municipality_ID=@ExpDet_Municipality_ID and Exp_Reporting_Year=@Exp_Reporting_Year
If @ExpDetailsID >= 0
Begin
INSERT INTO [dbo].[TBL_EXPENDITURE_DETAILS]
([ExpDet_ExpID]
,[ExpDet_Municipality_ID]
,[ExpDetGeneralFund]
,[ExpDetSpecialRevenue]
,[ExpDetCapitalProjects]
,[ExpDetTotal]
,[Exp_Reporting_Year]
,[ExpComments]
,[ExpDetCreatedBy]
,[ExpDetCreateDate])
VALUES
(@ExpDet_ExpID,
@ExpDet_Municipality_ID,
@ExpDetGeneralFund,
@ExpDetSpecialRevenue,
@ExpDetCapitalProjects,
@ExpDetTotal,
@Exp_Reporting_Year,
@ExpComments,
@Contact_ID,
GetDate()
)
SET @ExpDetailsID = SCOPE_IDENTITY()
return @ExpDetailsID
end
I swear I'm overthinking this as I've tried different combinations to do an insert from Code Behind to my Sql DB.
This is what my table looks like:
[Code]....
My code behind:
[Code]....
I suspect that the problem may be my date. The format that goes from the UI is mm/dd/yyyy.
Sometimes Convert.ToInt32(object) will work and other times (Int32)object will work. How do you know which to use? I usually try one and if it doesn't work use the other but I'm sure that's not the best approach.
View 4 RepliesI am writing unit tests for fluent Nhibernate, when I run the test in isloation it passes, but when I run multiple tests. or run the test more than once it starts failing with the message below System.ApplicationException : For property 'Id' expected '1' of type 'System.Int32' but got '2' of type 'System.Int32'
[TextFixture]
public void Can_Correctly_Map_Entity()
{
new PersistenceSpecification<UserProfile>(Session)
.CheckProperty(c => c.Id, 1)
.CheckProperty(c => c.UserName, "user")
.CheckProperty(c => c.Address1, "Address1")
.CheckProperty(c => c.Address2, "Address2")
}
I have an output parameter called '@packIds', that I create in ADO.Net using the code below:
SqlParameter packIdPara = new SqlParameter("@packIds", null);
packIdPara.SqlDbType = SqlDbType.VarChar;
packIdPara.Direction = ParameterDirection.Output;
sqlCmd.Parameters.Add(packIdPara);
How will I specify that the parameter '@packIds' is of max size? I cannot find any code for this.
[Code]....
I have a few applications/websites running with LINQ to SQL and the other day I decided to go ahead and optimize some of the queries, etc and I found that the size for variable length data types is derived from the parameter value instead of the column actual size? for example a column is defined as nvarchar(30). when I use linq to query that column with a value that's 5 characters long the parameter in sp_executesql will be defined as nvarchar(5)...this causes a major procedure cache bloat even for a small utility site that has a lot of queries is there a way to optimize this?
View 1 RepliesHow to convert string value to int32.
In timsplit i have value "17:00 - 2:00".Then i am converting it TimeIn and TimeOut.TimeIn is string now and how to convert it to int32.I am getting error while convertin
Timesplit = strResultData.Split('-');
string TimeIn = Timesplit[0];
string TimeOut = Timesplit[1];
int TimeI = Int32.Parse(TimeIn);
Currently i using gridview to display a person informaton based on his login id however it show error because the session is set to ToString. Is it a way to convert the session to int32?
[Code]....
I am passing query string and the url is as follows-> http://localhost:1086/Web/EditMobile.aspx?sno=2. But when i try to enter the url as follows,localhost:1086/Web/EditMobile.aspx?sno=2*3424324423432424* , i get the following error->Value was either too large or too small for an Int32. How do i handle this error. I must get an error report like " the value is not found in the table or database"
View 1 RepliesI am facing problem while executing followinf linq query ..
[Code]....
Here i feel that problem is due to
[Code]....
method , this method is private method return for fetching age of the user based on the birthdate of the user..
I know the content palcehlder does not have a size ,I have a masterpage and content page, the master page has a table with a header, content area, and footer, header and footer are fixed size, content area is 100%. As the user sizes the browser the content area grows and shrinks and the footer stays at the
bottom of the browser window - perfect!
Problem: The contentpalceholder does not grow to fill the available content area. Now, the contentplaceholder gets its size from its contents, which in this case is a div holding a silverlight object.I was thinking I could hook the master or child page's re-size event and somehow pass that info onto the SL object, but as it turns out (and I'm surprised I never knew this) there is no aps.net page re-size event! (really?, wow.)
So is there a way to get a SL object hosted on a master page to size itself based on the size of the browser window?Or more generally, a way to size the contents (like a div or panel) of a contentplaceholder based on the browser? on a standard aspx page (not a master page) I CAN get the SL object to size itself based on the broswer, the problem seems to come from the fact that I'm hosting the SL object in a content placeholder.
I guess I could 'unroll' the master page into several standalone pages and have it work, but the menu is on the master page and I'm used to using them, plus it's already done...<sigh>
I am using TabContainer with some controls on each tab (asp: labels, text boxes). When redirecting to the page that contains the TabContainer, the tabs and their content loads as expected, but when there is a postback, and the page refreshes, the TabContainer UI changes - the font size of the labels gets bigger, the text boxes become bigger and their location changes a bit (not aligned as before), and the tab header is partially hidden. I am using IE7.
I dont know if this is relevant but in some of the text boxes i use edit mask extender as well for date. Also, I have used a table inside the TabContainer for layouting the controls.
I am using PageMethods to send a few parameters to a webmethod in my codebehind. The method runs a stored procedure and uses the results to build a string that I am returning from the method.
Everything works fine until I try to include too many records in my results..
Once the results I am trying to return hit about 70K, the pagemethod times out even though it is taking about 1 second to process the results.
Is there a buffer limit or limit on the size or results returned from a pagemethod and if so, where can this be set or changed?
Is there a setting in the web.config somewhere to handle pagemethod buffer size?
In login.aspx I have used login control to enter user name and password, the problem is: even my caps lock is off when I enter user name it prints in capital letters but size is small size (when I copy and paste in note pad or msword it paste in small letters not in capital letters), when I turn on my caps lock on and type - it prints in bigger size as if I am typing in capital letters.
ex: 1. temp is my user name if my caps lock is off it shows like this TEMP (but size in smaller than 2nd one)
2. if my caps lock is on is shows like this as if I am typing capital letters TEMP
what do you think the problem is how can I fix it
As I know, by default Cache is stored in the memory and to the disk at the same time DiskCacheable=true).When the cached response is removed from the output cache due to memory pressure, it still remains on disk allowing a much larger set of pages to be cached. In addition, disk cached pages survive application restarts. And this is already in ASP.NET 2.0.I dont't know in which order the caches are removed from the memory and readen from disk instead? I would like to achive, that caches with the minimal trafic, or the longest last used, would be removed first from the memory. Is there some settings to do that, or even by default works that way?
View 1 RepliesHere's the scenario:I have an asp.net webpage which displays dynamic data in a gridview.I'm using a master page to display the header and footer of the page, and this gridview is being displayed inside a div in the contentplaceholder.
The Problem:What I want is that the size of the page that is displayed remains constant for a user and must be equal to the size of their browser's available display area and the content being visible by scrolling the div.Sort of like the header and footer remain at the same position and the content inside it is scrollable.
according to the developer of the web service I am calling.He said "bump up the default values for the following":
maxBufferSize="4096000"
maxReceivedMessageSize="4096000"
Where can I put these to bump them up? I've tried googling these settings, and I get sections of web.config that I don't have. I don't have a WCF client, either. Does this make sense to do from my web service, developed in VS 2010?
I'd like to just call his service without changing anything, get the error, and then go from there. I'm even getting that far because I got some other exception saying server was unable to process request, but it had nothing to do with exceeding a buffer size.
I have a master/detail scheme for editing an asp:GridView using an asp:DetailsView. One of my fields is for a phone number of type int64 (always 10 digits). I would like this field to always be displayed as (###)###-####. My issue is the first digit in the phone number is always truncated for my edit item field which I used a MaskedEditExtender to achieve the formatting.
Here is my EditItemTemplate for the details view:
<cc1:MaskedEditExtender TargetControlID="edtPROJ_Leader_Phone" Mask="(999)999-9999" runat="server" ClearMaskOnLostFocus="false" ClipboardEnabled="true" MaskType="Number" />
<asp:TextBox ID="edtPROJ_Leader_Phone" runat="server" Text='<%# Bind("PROJ_Leader_Phone") %>' ></asp:TextBox>
When my details view is displayed for editing, the text box displays(_23)456-7890 for the integer 1234567890. Also worth noting that if the property MaskType="Number" is removed, the textbox shows:
(234)567-890_. I would of course have the textbox show (123)-546-67890 after binding.
I have a database table with all columns to allow nulls for testing purposes. Between all of my columns I have int, varchar or bit datatypes. When I try to submit the form I get the following error message:
Value was either too large or too small for an Int32.
Here is the code:
using (storeDataContext db = new storeDataContext())
{
db.Dealerssses.InsertOnSubmit(new Dealersss [code]....
I am trying to get a sample project to work with dotnetopenauth and facebook.I have this code
namespace OAuthClient
{
using System;
[code]...
the maximum number of files in a folder, I noticed that DirectoryInfo.GetFiles().Length is returning a System.In32, but the Maximum value of a Int32 is 2.147.483.647 (Int32.MaxValue) while on NTFS (an many other filesystems) the maximum number of files can go far beyond that.
on NTFS it is 4.294.967.295 single files in one folder (probably an Uint32)
Which leads me to the interesting question:
Is it possible to get the number of files in a folder on NTFS with the .NET framework, when the number of files exceeds the Int32.MaxValue, in an elegant and performing manner?
I am working with MVC2 and one of the view model's properties is IDictionary<Int32, String>.
This is not to be changed on the view. But when the form is posted back I would like to still get those values.
Can Html.Hidden store this property values?
How should I do this so the model still gets the IDictionary<Int32, String> values on the POST action?
I got the following error when i tried to insert a new record after the run my project, so what does this error indicates?
"{"Cannot insert explicit value for identity column in table 'Articles' when IDENTITY_INSERT is set to OFF."} System.Exception {System.Data.SqlClient.SqlException}
"