URGENT - CURRENCY STRING FORMAT IN SSAS

Apr 24, 2008



In cube created by me, there is one measure called SALES AMOUNT, i defined its Format String as Currency.
And there is one Calculated measure Average Sales Amount, that also have the Format string as Currency.

But for some strange reasons, when I Pull Sales Amount it is coming with $ prefix, but when I pull Average Sales Amount it is coming with prefix Rs....

can anyone help me, what is going wrong here.. its very urgent.

View 7 Replies


ADVERTISEMENT

Input String Was Not In A Correct Format For Formatted Currency

Nov 17, 2005

Ok, when I bind a textbox in my FormView I'm changing the format to
currency (<%# Bind("TotalValue","{0:c}") %>).  When I click
Update I get "Input string was not in a correct format" since
TotalValue is Int32 data type.

Shouldn't it convert it back to Int32 when it updates the db?  Or do I have to do it manually, and if so how?

View 2 Replies View Related

Format Currency

May 28, 2008

How do I get data that looks like 200,000 returned as a currency format?

Here is what I have in my select statement it doesn't work and can't seem to find an example that works or maybe I just have it set up wrong?

'$' + convert(Sum(OrderHeader.SubTotal)as money) as 'Total Sales'

Ultimately I have a field that is returned and it exists on a reporting services report. I can't find a way just to format the field as currency through the properties either would that be the better way to do it if there is a way?

View 2 Replies View Related

Currency Format.

Feb 21, 2008

Hi!

I have money value of 56.0000.I want it to only give me the last two decimal places,56.00.I used this one to come up to that result:cast(round(sum(total),2)as int)but my result is this 56.Am i on the right track?

Funnyfrog

View 13 Replies View Related

Currency Format

Dec 14, 2006

The $ must appears only on certain total levels and has to be in the same position in the column regardless of the value for financial reporting. In other words, I don't want the $ to float next the most significant digit in the value. See the example below from Excel. Using an IIF statement I can concatenate the $ to the string when it is a certain group level. However, I have tried many various formatting strings but can't find one that results in a fixed number of characters so that the $ will always appears in the same position in the column.

Anyone have a way to do this?













General Government
222
3.45%
$ 405,590,654
1.98%



Public Buildings
194
3.01%
375,453,314
1.83%



Other Facilities
22
0.34%
21,324,140
0.1%



Property Acquisition
6
0.09%
8,813,200
0.04%



Grand Total
6,439
100.0%
$ 20,507,977,298
100.0%



I did get this to work by adding a column to the grouping. That somehow causes the heading size to increase (??) and takes much more time than coding a format code in an expression (I have many reports to do).

View 4 Replies View Related

How Do I Change The Currency Format?

Nov 28, 2007

It's probably right underneath my nose, but I cannot seem to be able to set the currency format.

My Stored procedure returns an integer that represents a cash value in pennies (like cents).

I then divide this value by 100 and convert it to a Double, so its value is represented in Pounds.

This all works fine, my problem is that when I wrap the above logic in a FormatCurrency, I get a dollar ($) sign before it. How can I change this so that it gives a pound sign (£)?

View 8 Replies View Related

Please Help: HOW TO FORMAT CURRENCY TO NEGATIVE AMOUNT

Aug 23, 2004

Please help!!!
I'm building a database that I have a form. This form allows user input the invoice amount field which is the currency field. My ultimate goal is allow user put in the postive numbers and it will store as negative amount. Please let me know if there is the way to do that.
Thanks in advance.
Linh

View 1 Replies View Related

Currency Format When Exporting To Excel

Apr 24, 2007

Hi,

I have a problem with the number format when i export my reports to excel with Reporting Services. I set numbers as currency with the command FormatCurrency() in visual studio, but when i export the report to excel, the numbers are considered as text.

Does anyone have a solution?
Thanks in advance.

View 2 Replies View Related

Format Strings For Fractional Numbers And Currency

Nov 17, 2005

/*
Format strings for fractional Numbers and Currency values

Return Values: VARCHAR
Parameters: @n Specifies numeric expression to format.
@sFormat: Specifies one or more format codes that determine how the expression is formatted.

The following table lists the available format codes.

9.000000|00 |09
12.100000|### |12
12345.120000|### ### ###.000|12 345.120
12345.120000|### ### ###.###|12 345.12
12345.120000|$ ### ### ###.000|$ 12 345.120
12345.120000|### ### ###.### $|12 345.12 $
12345.120000|$ ###,###,###.000|$ 12,345.120
12345.120000|### ### ###.000|12 345.120
12345.120000| |12345
1.120000|### ### ###.000|1.120
12.120000|### ### ###.000|12.120
123.120000|### ### ###.000|123.120
1234.120000|### ### ###.000|1 234.120
12345.120000|### ### ###.000|12 345.120
123456.120000|### ### ###.000|123 456.120
1234567.120000|### ### ###.000|1 234 567.120
12345678.120000|### ### ###.000|12 345 678.120
123456789.120000|### ### ###.000|123 456 789.120
1234567890.120000|### ### ###.000|1234 567 890.120
12345678901.120000|### ### ###.000|12345 678 901.120
123456789012.120000|### ### ###.000|123456 789 012.120

*/

CREATE FUNCTION xNumberFormat(@n NUMERIC(38, 4), @sFormat VARCHAR(255))
RETURNS VARCHAR(255) AS
BEGIN
DECLARE @sRet VARCHAR(255), @i TINYINT, @j INT, @nDec TINYINT, @sNumber VARCHAR(255), @cF CHAR(1), @cR CHAR(1), @sE VARCHAR(255), @sX VARCHAR(255)

SELECT @sE = '', @i = LEN(@sFormat)
WHILE @i > 0 AND SUBSTRING(@sFormat, @i, 1) NOT IN ('#', '0') SELECT @sE = SUBSTRING(@sFormat, @i, 1) + @sE, @i = @i -1
SELECT @sFormat = LEFT(@sFormat, @i), @sX = '', @i = 1
WHILE @i < LEN(@sFormat) AND SUBSTRING(@sFormat, @i, 1) NOT IN ('#', '0') SELECT @sX = @sX + SUBSTRING(@sFormat, @i, 1), @i = @i +1
SELECT @sFormat = RIGHT(@sFormat, LEN(@sFormat) - @i + 1)

IF @n = 0 AND CHARINDEX('0', @sFormat) = 0 AND @sE = '' AND @sX = '' RETURN ''

SET @nDec = CHARINDEX('.', @sFormat)
IF @nDec > 0 SET @nDec = LEN(@sFormat) - @nDec

SET @sNumber = RTRIM(LTRIM(STR(@n, 255, @nDec)))

IF @nDec > 0 SET @nDec = @nDec + 1

SET @sRet = RIGHT(@sNumber, @nDec)

IF @nDec > 0
BEGIN
SET @i = 1
WHILE RIGHT(@sRet, 1) = '0' AND SUBSTRING(@sFormat, LEN(@sFormat) - @i + 1, 1) = '#' SELECT @sRet = LEFT(@sRet, LEN(@sRet) - 1), @i = @i + 1
IF @sRet = '.' SET @sRet = ''
END

SELECT @i = @nDec + 1, @j = @nDec + 1
WHILE @i <= LEN(@sFormat) AND @j <= LEN(@sNumber)
BEGIN
SELECT @cF = SUBSTRING(@sFormat, LEN(@sFormat) - @i + 1, 1), @cR = SUBSTRING(@sNumber, LEN(@sNumber) - @j + 1, 1)
IF @cF NOT IN ('#', '0')
IF @j = LEN(@sNumber) AND @n < 0 SET @i = @i + 1 ELSE SELECT @sRet = @cF + @sRet, @i = @i + 1
ELSE
SELECT @sRet = @cR + @sRet, @i = @i + 1, @j = @j +1
END
IF @j <= LEN(@sNumber) SET @sRet = LEFT(@sNumber, LEN(@sNumber) - @j + 1) + @sRet
WHILE @i <= LEN(@sFormat) AND SUBSTRING(@sFormat, @i - @j + 1 , 1) = '0' SELECT @sRet = '0' + @sRet, @i = @i + 1
RETURN @sX + @sRet + @sE
END

View 4 Replies View Related

String To Currency

Sep 28, 2007

Hello forum,
I am quering a datebase table from an asp page, comparing values that the user input in a form, value is a string 1000000 and the field in the database that i am compparing from is a currency type, i am getting an error saying that i need to convert to currency, type mistmatch. i am using the following to convert but it does not work, any suggestions.

here is my query:
"SELECT STotalAllocation FROM tabletoquery where STotalAllocation >='" & CCur(Session("plusMillion")) & "' "

'Session("plusMillion") is equal to 1000000

this is the error:
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E07)
Disallowed implicit conversion from data type varchar to data type money, table 'SiteDetail7CMaster', column 'STotalAllocation'. Use the CONVERT function to run this query.
search_report.asp, line 136

View 4 Replies View Related

Format Currency In SQL Server 2005 Reporting Servi

Apr 15, 2008

currency format in sql 2005 reporting services.
How to format amount do not display numbers after decimal point? e.g. if the value in the database 139000.82 what function to use (other than C or FormatCurrency)to display amount in the report such as $139,000?
Thank you to all!

MY

View 6 Replies View Related

Help Needed Little Urgent---how To Convert The String Date To Standard Date Format In SQL Table

Sep 28, 2007

Using DTS package in 2000 version, I am dumping TXT file contents into SQL Table,

I have one column having date in format YYYYMMDD(20070929) and corresponding column in SQL is datetime, but it fails on data type mismatch.

I have no choice of making date column in SQL to string or Varchar etc,

is there any way to make that date column in SQL to convert the value upon transformation from format (YYYYMMDD) to M/DD/YYYY (9/29/2007).

many many thanks,

View 2 Replies View Related

Date In String Format Has To Be Changed Datetime Format

Jun 15, 2005

I have date coming to one page as a string in the following format"May 4 2005 12:00AM"
I need to query one of my tables using this date in combination of other nondate values. How can I convert this date into valid sql server datetime format before I query a database tables
Please help
 

View 3 Replies View Related

Transact SQL :: How To Format A String In A Format Coming From A Table

Jun 4, 2015

I have a table which stores date-of-birth in varchar 19861231(yyyymmdd). A view takes this data. I want to store this date as mmddyyyy in the view. How can we achieve this?

View 18 Replies View Related

SSAS 2005 Connection String

Mar 20, 2007

i am trying to connect to ssas 2005 -- i can get to it through management studio no problem. i cant seem to get my program to connect

can anyone see anything wrong with this connection string

Provider=MSOLAP;User ID=myid;Password=mypass;Data Source=mysrvr;Initial Catalog=mycat;Client Cache Size=25;Auto Synch Period=10000;

View 2 Replies View Related

Urgent Format Que

Oct 31, 2007

 I have a urgent need for a date format.I have a third part
tool which inserts date into the database in the format  ( 7/1/2007 ) 
but what i want to display is 07/01/07).Kindly suggest fast as I have to put this to production shortly.Thanks

View 4 Replies View Related

Urgent Help On Date Display Format

Nov 12, 2007

Hi,
I am using a sql database and vb.net... In form i display a date from calendar as smalldatetime in the format of dd/MM/yyyy by changing the web.config file to culture = "en-GB"... It did display as dd/MM/yyyy with no doubt... Problem is in sql database it is display as mm/dd/yyyy, there4 when i retrieve it out, it is not the format i wan... so can any1 helps mi? I need do many adding and subtracting to the date so a constant dd/MM/yyyy format is veri important to mi... I cant save it as yyyy/mm/dd cos my boss dun wan it... If use Convert method when i select * out how to convert the date zzz
Helps would be greatly appreciated

View 9 Replies View Related

Urgent Help!-how To Format After Getting Rows? For Newline

Oct 8, 2004

while(@@FETCH_STATUS=0)
begin
print 'inside while'

set @BodyContents = @BodyContents+@gotclientName+@gotproductName
set @Body= @Body + @BodyContents + ','

fetch next from resultcursor into @gotclientName,@gotproductName

print 'going outside of while'
end --while end

Client Name Product Name
aaa test1
bbb test4

how to format row like above. currently i am getting
aaa,test1,bbb,test4

View 1 Replies View Related

Date Format: Urgent Help Needed

Dec 12, 2007


I have a date "4/25/2007"
but the requirement is to have data as "04/25/2007"
.if month is single digit it should have leading zeroes, same with date,
can some tell me how to convert this.

View 2 Replies View Related

Urgent Help : Date Format Conversion

Dec 12, 2007

I have a date "4/25/2007"
but the requirement is to have data as "04/25/2007" in datamart.
if month is single digit it should have leading zeroes, same with date,
can some tell me how to convert this.

View 7 Replies View Related

Urgent (External Table Is Not In The Expected Format)

Aug 10, 2007



Hi,
I have 7 excel files that i have to import to sql server database and in that 6 of them work fine. But when i try to import the 7 one i get an

oledb exception saying that External table is not in the expected format.

So can i someone please help me with this error.

Regards
Karen


View 6 Replies View Related

URGENT: UNIX DATE FORMAT CONVERION TO SQL SERVER

May 9, 2001

I HAVE ONE COLUMN CONTAING THE INTEGER TYPE DATA COMING in UNIX DATE FORMAT. NEED TO CONVERT IT TO THE SQL SERVER DATE TIME FORMAT.

NOTE: UNIX IS STORING THE DATE IN SECONDS STARTING FROM 1970/1/1

ANYBODY CAN HELP ME TO SOLVE THIS PROBLEM.

e.g. The UNIX date time is 973101026 need to be converted to SQL DATE TIME

View 2 Replies View Related

Format String

Aug 8, 2000

I have to convert From Sybase to SQL Server and I've got fields type in Sybase which are long varchar (length around 60000).
At first, I convert in format text but SQL Server refused to pass this type for parameters in stored procedures when i need that. So I have used varchar(8000) in stored procedures. But I'm afraid it would be truncated in the application.
So what is long varchar in SQL Server and how to use that by optimistic way ?
Thanks

Axel

View 2 Replies View Related

Format A String

Oct 22, 2004

I have a column in a database that is a phone number. The problem is that it is stored like so

4589958

Anyway that I can insert a "-" after the first 3 digits in SQL SELECT statement

View 3 Replies View Related

String.Format({0:###-##-####}, ...)

May 22, 2007

I have this line in my script component and it's not producing the number with dashes.



Row.TAXIDNO = String.Format("{0##-##-####}", Row.TAXIDNO)



What the hell is going on?



Thanks.

View 4 Replies View Related

String Format

Nov 14, 2006

Hai
I have a table call TimeMgt, and i have got a field name call TimeDifference like this:

TimeDifference (varchar(255))
------------------
10.230
10.856222
25.355542
85.2455
12.98888882542533


Now need to get this out put

TimeDifference
------------------
10.23
10.85
25.35
85.24
12.98

In this case i cant use cast(TimeDifference as decimal(16,2))
becasse eg :
12.98888882542533 values after writing this sql cast(TimeDifference as decimal(16,2))
gives me this result ===== 12.99====wrong!

i want to display like this 12.98

Ho do I do this task ? what is the best way to format like this ? Is there any straight methods to do this task ?
sujithf

View 5 Replies View Related

Format Values Into One String

Oct 18, 2007

HI!

I do a select and concatinating the answers into a one column table @tab(string).
Is it possible to format these values like this:
GENAV DELAV TOTIP RES
12 myvalues www.notech.com 1
1 starthere 192.168.0.2 1
125 or here www.hereistomanychar.s 0

max 3 max 10 max 22 max 1

the first column max 3 characters the second column max 10 char...
I want to do this to get a good view of the data i the table @tab

Here is the select:


INSERT INTO @tab

SELECT Convert( varchar, GENAV)+ ' ' + Convert( varchar, DELAV)+ ' ' + Convert( varchar, TOTIP) ' ' + Convert( varchar, RES)

from dbo.MOVE

where DATE between @starttime and @theEndTime


With this select it looks like:

12 myvalues www.notech.com 1
1 starthere 192.168.0.2 1
125 or here www.hereistomanychar.s 0

This is very complicated to read!

View 6 Replies View Related

Re-applying Format String

Feb 6, 2008

Hi,

I'm retrieving data from a cube using a datareader, all the measures have format string, but when retrieve from Integration services it's lost.

I know there is a way to get the format string as columns using extended properties of the conection. I haven't tried this yet, but is there any way of reapplying this format to the columns using this format strings??

thanks

View 3 Replies View Related

Urgent- Sqlconnection String

May 4, 2006

hi,

Can anybody help to guide how to extract/check the sql connection string in SQL Server 2k?

Any hit will be sincerely appreciated.

Regards

View 5 Replies View Related

Input String Was Not In A Correct Format.

Aug 8, 2006

I get this error when executing a stored procedure from my code. I suppose something's going wrong with data types, but I cannot see what. If anyone has a sharper eye and can see what it is, please let me know. Thanks in advance!Here is a code excerpt:         int category = Convert.ToInt32(ddlCategories.SelectedValue);        int museum = Convert.ToInt32(ddlMuseums.SelectedValue);        int collection = Convert.ToInt32(ddlCollections.SelectedValue);        string binomen = txtScientName.Text;        string locality = txtLocality.Text;        command.CommandType = CommandType.StoredProcedure;        command.Parameters.Add(new SqlParameter("@taxparent", category));        command.Parameters.Add(new SqlParameter("@museum", museum));        command.Parameters.Add(new SqlParameter("@collection", collection));        command.Parameters.Add(new SqlParameter("@binomen", binomen));        command.Parameters.Add(new SqlParameter("@locality", locality));And the stored procedure code: ALTER PROCEDURE [petrander].[DynamicQuery]     @taxparent int = NULL,     @museum int = NULL,     @collection int = NULL,     @binomen Nvarchar(254) = NULL,     @locality Nvarchar(254) = NULLAS    SELECT *    FROM QueryView    WHERE         InstitutionCode = COALESCE(@museum, InstitutionCode) AND        CollectionCode = COALESCE(@collection, CollectionCode) AND        ScientificName LIKE '%' + @binomen + '%' AND         Locality LIKE '%' + @locality + '%' AND         ParentID1 = COALESCE(@taxparent, ParentID3) OR        ParentID2 = COALESCE(@taxparent, ParentID2) OR        ParentID3 = COALESCE(@taxparent, ParentID3) OR        ParentID4 = COALESCE(@taxparent, ParentID4) OR        ParentID5 = COALESCE(@taxparent, ParentID5) OR        ParentID6 = COALESCE(@taxparent, ParentID6) OR        ParentID7 = COALESCE(@taxparent, ParentID7) OR        ParentID8 = COALESCE(@taxparent, ParentID8)

View 1 Replies View Related

Input String Not In Correct Format

Dec 28, 2006

HiI have just started using Visual Web Developer to produce
asp.net page. I am having a problem when inserting a new record into a
particular table, within the insertion form I have included a drop down
list which gathers informaton from another table. When I view the page
through the browser when I click the insert link I get an error message
on stating 'Input string not in correct format' . The code for the page is below. Does anyone know what
the problem could be? Thanks <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="PhotoAdmin_Default" title="Untitled Page" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">    <asp:Label ID="UserIdValue" runat="server"></asp:Label><br />    <asp:SqlDataSource ID="pictureDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"        DeleteCommand="DELETE FROM [Pictures] WHERE [PictureID] = @PictureID" InsertCommand="INSERT INTO [Pictures] ([UserId], [CategoryID], [Title], [Description], [UploadedOn]) VALUES (@UserId, @CategoryID, @Title, @Description, @UploadedOn)"        SelectCommand="SELECT * FROM [Pictures] WHERE ([UserId] = @UserId) ORDER BY [UploadedOn] DESC"        UpdateCommand="UPDATE [Pictures] SET [UserId] = @UserId, [CategoryID] = @CategoryID, [Title] = @Title, [Description] = @Description, [UploadedOn] = @UploadedOn WHERE [PictureID] = @PictureID">        <DeleteParameters>            <asp:Parameter Name="PictureID" Type="Int32" />        </DeleteParameters>        <UpdateParameters>            <asp:Parameter Name="UserId" />            <asp:Parameter Name="CategoryID" Type="Int32" />            <asp:Parameter Name="Title" Type="String" />            <asp:Parameter Name="Description" Type="String" />            <asp:Parameter Name="UploadedOn" Type="DateTime" />            <asp:Parameter Name="PictureID" Type="Int32" />        </UpdateParameters>        <SelectParameters>            <asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text" />        </SelectParameters>        <InsertParameters>            <asp:Parameter Name="UserId" />            <asp:Parameter Name="CategoryID" Type="Int32" />            <asp:Parameter Name="Title" Type="String" />            <asp:Parameter Name="Description" Type="String" />            <asp:Parameter Name="UploadedOn" Type="DateTime" />        </InsertParameters>    </asp:SqlDataSource>    <asp:SqlDataSource ID="categoriesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"        SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] ORDER BY [Name]">    </asp:SqlDataSource>    <asp:SqlDataSource ID="maxPictureIDDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"        SelectCommand="SELECT MAX (PictureID)&#13;&#10;FROM Pictures&#13;&#10;WHERE UserId = @UserId">        <SelectParameters>            <asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text" />        </SelectParameters>    </asp:SqlDataSource>    <br />    <asp:DetailsView ID="dvPictureInsert" runat="server" AutoGenerateRows="False" DataKeyNames="PictureID"        DataSourceID="pictureDataSource" DefaultMode="Insert" Height="50px" Width="125px">        <Fields>            <asp:BoundField DataField="PictureID" HeaderText="PictureID" InsertVisible="False"                ReadOnly="True" SortExpression="PictureID" />            <asp:TemplateField HeaderText="CategoryID" SortExpression="CategoryID">                <EditItemTemplate>                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:TextBox>                </EditItemTemplate>                <InsertItemTemplate>                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="categoriesDataSource"                        DataTextField="Name" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">                        <asp:ListItem>--None--</asp:ListItem>                    </asp:DropDownList>                </InsertItemTemplate>                <ItemTemplate>                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:Label>                </ItemTemplate>            </asp:TemplateField>            <asp:TemplateField HeaderText="Title" SortExpression="Title">                <EditItemTemplate>                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>                </EditItemTemplate>                <InsertItemTemplate>                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox><br />                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"                        Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>                </InsertItemTemplate>                <ItemTemplate>                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Title") %>'></asp:Label>                </ItemTemplate>            </asp:TemplateField>            <asp:TemplateField HeaderText="Description" SortExpression="Description">                <EditItemTemplate>                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>                </EditItemTemplate>                <InsertItemTemplate>                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox><br />                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"                        Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>                </InsertItemTemplate>                <ItemTemplate>                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("Description") %>'></asp:Label>                </ItemTemplate>            </asp:TemplateField>            <asp:CommandField ShowInsertButton="True" />        </Fields>    </asp:DetailsView>    <br />    <br /></asp:Content> 

View 3 Replies View Related

Input String Was Not In A Correct Format.

May 21, 2007

I am using SQL Server Express and Visual Web Developer Express with VB as my preferred language.
I am trying to specify an InsertParameter with a querystring parameter of a SQLDataSource Control.
My Code is:
<InsertParameters>
<asp:Parameter Name="ProjectID" Type="Int32" DefaultValue="Convert.ToInt32(Label1.Text)" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Size" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
I get the error message above and the detail is:
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:




An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:




[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753299
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102
System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +248
System.Web.UI.WebControls.Parameter.get_ParameterValue() +67
System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +255
System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +265
System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +214
System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +68
System.Web.UI.WebControls.FormView.HandleInsert(String commandArg, Boolean causesValidation) +389
System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +609
System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e) +88
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e) +109
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +86
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +155
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +172
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921

I have verified that Label1.Text has a value that looks like an integer. What is causing the problem? Is there a better way of creating a new record in the child table and making one of the fields match the primary key of the parent table?
Thanks.

View 7 Replies View Related

Input String Was Not In A Correct Format.

Nov 15, 2007

Hi!I get this message: System.FormatException: Input string was not in a correct format.
when i try to execute this code:
 TextBox tbox = new TextBox();
string Date;
string Title;
string Text;
string sUserName = HttpContext.Current.User.Identity.Name;
MembershipUser User = Membership.GetUser(sUserName);
string UserID = User.ProviderUserKey.ToString();
int NewsID = Convert.ToInt32(ViewEditNews.DataKeys[e.Item.ItemIndex]);

tbox = (TextBox)e.Item.FindControl("EditNewsDateTxt");
Date = tbox.Text;

tbox = (TextBox)e.Item.FindControl("EditNewsTitleTxt");
Title = tbox.Text;

tbox = (TextBox)e.Item.FindControl("EditNewsTextTxt");
Text = tbox.Text;

GetNews.UpdateCommandType = SqlDataSourceCommandType.Text;
GetNews.UpdateCommand = "UPDATE ovarvet.News SET HeadText=@Title, Text=@Text, Date=@Date, UserID=@UserID WHERE NewsID=@NewsID";
GetNews.UpdateParameters.Add("Title",TypeCode.String, Title);
GetNews.UpdateParameters.Add("Text", TypeCode.String, Text);
GetNews.UpdateParameters.Add("Date", TypeCode.String, Date);
GetNews.UpdateParameters.Add("UserID", TypeCode.UInt32, UserID);
GetNews.UpdateParameters.Add("NewsID", TypeCode.Int32, NewsID.ToString());

GetNews.Update();


ViewEditNews.DataBind();
ViewEditNews.EditItemIndex = -1;
ViewEditNews.DataBind(); Anyone who knows the problem with this code?

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved