Databases :: Date Field Shows Up As Decimal, IBM AS400?

Feb 2, 2010

I am getting a DataTable from query against AS400 database. The field that clearly contains birth dates is interpreted as decimal. I am having trouble even converting it to string.

View 1 Replies


Similar Messages:

Databases :: Calling AS400 Stored Procedure From C# Coding?

Sep 12, 2010

I have a req in which I have to call an AS400 stored procedure.The stored has an input and output parameter.

View 9 Replies

Databases :: Connection String -- Connecting AS400 Table In .net?

Dec 23, 2010

how can i access an AS/400 Database/Table in ASP.net website.I thought i would add something like this in web.config, but it does not work.

<connectionStrings>
<add name="AS400" connectionString="Driver={Client Access ODBC Driver (32-bit)};SERVER=IP Address; USER=usr; PASSWORD=pwd; "/> [code].....

View 2 Replies

Databases :: Parameterized Query And Date Field?

Sep 17, 2010

[Code]....

This is a query to an old FoxPro database on a server (Same Network). This work in the execution, but just passing the date values as aaaa/mm/dd.On my page when a pass two DateTime Parameters from two TextBox it throw "Unable to recognize the string as a valid DateTime Value"I'm using Ajax Calendar exterder on the textbox to be more specific.Here, (My Country) the format i'm using es dd/mm/aaaaAnd when i select the datepicker it comes in this format, and then a get the DateTime error type.I can get the rows in the query builder just passing the date like "2010/01/15" and "2010/01/30" for example.Hay can i force the texbox to get this format aaaa/mm/dd?

View 4 Replies

Databases :: MySQL - CSharp To Assign Null Date Time To A Class Field?

Feb 21, 2011

Using MySQL 5.

In my SAP.NEt project, defined a constant:

public static DateTime NullDateTime = DateTime.MinValue;

I have a function:

protected static DateTime GetDateTime(DataRow row, string columnName)
{
return (row[columnName] != DBNull.Value) ?
Convert.ToDateTime(row[columnName]) :
Globals.NullDateTime;
}

In the source code:

public DateTime StationFeedTime{ get; set; }
StationFeedTime = GetDateTime(row, "StationFeedTime");

I ran a SQL to fetch records from MySQL, this field is Time field in MySQL.

Got an exception inside the function:

Unable to cast object of type 'System.TimeSpan' to type 'System.IConvertible'.

View 8 Replies

Databases :: Oracleparameter From A Dropdownlist, No Selection Shows All Records?

Dec 10, 2010

I am trying to find out the best method or practice to use a dropdownlist to feed my oracleparameter value. I currently have this working when I have a value selected in the dropdownlist. My issue is how to account for if the user leaves the dropdownlist empty. I want this to then return all data. My SQL has a where clause = to :HRM. I use a function that gets the text for my SQL from a text file. My dropdownlist box is populated via databind. I then inserted a item in my dropdown with 0 index with no text display and a value of "novalue" Below is my code to populate my dropdownlist

[Code]....

[Code]....

If I select an item and run my code it works great. This doesnt work with the no selection tho. Do I have to build the SQL dynamically with a check if the listbox is empty or not and then add the criteria? I was hoping there was a eailer way since I have many queries and parameters to build.

Here is part of my code using the oracleparameter.

[Code]....

I also saw a post about trying this, but I get an illegal error.

[Code]....

Not sure if I can replace the "AND HRM_FIELD = " text and use :HRM instead and then build the oracleparameter with an IIF to include the AND HRM_FIELD part.

View 2 Replies

ADO.NET :: LINQ Over DataTable Null Decimal Field ?

Feb 9, 2011

I'm having a spot of trouble figure out how to write my linq query so that is allows a decimal field in my datatable to be null

Right now I have this:

[Code]....

But it's not working. The error I am getting is: Cannot cast DBNull.Value to type 'System.Decimal'. Please use a nullable type.so how do I get it to allow program_ar_id to be null?

View 2 Replies

Get The Difference Between 2 Date In Month And With Decimal Value For The Day Left

Jan 23, 2011

Is there a way to get the difference between two dates in Month. I would like decimal for the day.

EX :

First Date : 2010-12-20
Second Date : 2011-12-30

This is like 1 months and 10 days between these date.

The difference should give me : 1.33

DateTime dt = new DateTime();
dt = Convert.ToDateTime("2011-12-30"); ;
DateTime dt2 = new DateTime();
dt2 = Convert.ToDateTime("2010-12-20");
int monthDiff = System.Data.Linq.SqlClient.SqlMethods.DateDiffMonth(dt,dt2);

View 2 Replies

Databases :: Oracle Date Formatting Null Date As 00/00/0000

Jan 3, 2011

Oracle Date Formating Null date as 00/00/0000

View 3 Replies

DataSource Controls :: How To Get Perclock Field To Show A Decimal

Feb 2, 2010

how to get my perclock field to show a decimal? For some reason I keep getting '0'.

View 3 Replies

Databases :: Converting Varchar Date To Date Format?

Aug 14, 2010

I am using mysql and stored date in varchar format, and compare that with current date,i have stored like(dd-mm-yyyy) in database

i need to compare it with date in select query. How to take date from database in dd-mm-yyyy format.

View 1 Replies

DataSource Controls :: Passing Null Value To A Decimal Datatupe Field?

Jun 16, 2010

I have req where i have to pass null value,if value coming from db is null.Problem here is the field datatype is 'Decimal' so all the time even though value is null ,its passing as zero.How can I pass a null value to decimal field in C#.

FieldValue = (reader["Field"] ==
DBNull.Value) ?
Convert.ToDecimal(null) :
Convert.ToDecimal(reader["field"]);

What I want is ,Field value will get null value assigned not zero.

View 4 Replies

Web Forms :: Decimal Field - Input String Was Not In A Correct Format

Nov 7, 2013

I have qi1 decimal field ... coming error in line ...

txtCostPrice = Convert.ToInt32(((TextBox)GridView2.Rows[i].FindControl("txtcostprice")).Text);

my code

public void savedata() {
con = new SqlConnection(dbcon);
con.Open();
int txtCostPrice = 0;
//int txtSellPrice = 0;
int Primarykey = 0;

[code].....

View 1 Replies

Web Forms :: If Date Is Not Inserted It Shows 1900-01-01 In Database?

May 7, 2015

i am using date field in sql table , and in webforms , i am using a textbox relating to calendar extender toolkit , now if i won't select anydate from calendar , on debugging it shows "" but in database it shows 1900-01-01 . what's this going on ? i have also written on button click event :

protected void SubmitProject_OnServerClick(object sender, EventArgs e) {
if (StartDate.Text == "" || StartDate.Text == string.Empty) {
rec.Proj_StartDate = DBNull.Value.ToString();
} else {
rec.Proj_StartDate=Request.Form[StartDate.UniqueID];
}
}

also i id like this too :

protected void SubmitProject_OnServerClick(object sender, EventArgs e) {
if (StartDate.Text == "" || StartDate.Text == string.Empty) {
rec.Proj_StartDate = string.Empty;
} else {
rec.Proj_StartDate=Request.Form[StartDate.UniqueID];
}
}

but nothing happened , it still shows 1900-01-01 in database.

View 1 Replies

Forms Data Controls :: How To Format Date And Decimal Number In Columns

Mar 24, 2011

In my gridview I have a datetime columns and couple of decimal number columns. Lets say I have a datetime value like this 19.03.2011 00:00:00 and I want it to seem like 19.03.2011. And I would like 2 decimal digits only. How can I achieve this?

View 2 Replies

DataSource Controls :: Format A Date Field In DataView.RowFilter To Consider Date Only - Not Time

Jan 27, 2010

I am filtering dataview using my Date Column but the result is not proper because the Field value also stores time, so I want to convert this Date Field to only Date during Filter. How can I achieve this? Here is my code. And the actual value I am getting in the Dataset Field "CreationDate" is a DateTime field which is like

2010-01-21 14:35:25.203
2010-01-22 12:55:18.033
2010-01-26 12:10:06.990

But I only want to neglet time value and want to compare Date only.

[Code]....

View 5 Replies

DataSource Controls :: : Update A Date Field To The System Date But It's Not Working?

Jan 27, 2010

I'm trying to update a date field to the system date but it's not working. Could someone please help with the syntax?

[Code]....

View 18 Replies

Forms Data Controls :: Bit Field, When Display It Shows True / False?

Mar 26, 2010

The following is a bit field, when display it shows true / false. How can i change the below to show a checkbox....

<asp:TemplateField HeaderText="calc_flag" Visible="True">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("read_only_flag") %>'></asp:Label>

[code]...

View 2 Replies

Forms Data Controls :: How To Force Control Input Format In Decimal Field In GridView

Mar 6, 2010

when updating a decimal field in a GridView all is fine when using e.g. "2.3" ("." to separate the fraction!)

However, when using "2,3" I get e formatstring exception!

I tried "regularExpressionValidator/RequiredFieldvalidator" but did not succeed! Tried also with FormatString like {0:n}.....

Questions:

is this controllable by "Culture / UICulture" in web.config (played with it without success!

How do I best check for correct input i.e. force "." as separator

Can I use the "DataFormatString" property for the appropriate GridView field (like {0:n}) ......

[code]....

View 1 Replies

Mvc: How To Automatically Fill The Date Field With Today's Date

Jan 23, 2011

Assume that a model has a datetime datatype.

So in view there will be a blank field ask you to input datetime.

Is there a way to fill this HTML field with today's date/datetime as default value?

View 2 Replies

C# - Connect To AS400 Using .NET?

Jul 26, 2010

I am trying to build a .NET web application using SQL to query AS400 database. This is my first time encountering the AS400.What do I have to install on my machine (or the AS400 server) inorder to connect?
(IBM iSeries Access for Windows ??)What are the components of the connection string?Where can I find sample codes on building the Data Access Layer using SQL commands?

View 1 Replies

Data Controls :: Round Up Decimal Value Upto Two Decimal Places In GridView

Aug 22, 2012

i hav one data table in which some decimal values are up 6 decimal places.. im trying to bind that Data table to DataGridView while binding i want to round decimal values up to two decimal palces here is my code

dt.Columns.Add("Orderid", typeof(string));
dt.Columns.Add("tagnumber", typeof(string));
dt.Columns.Add("Minimum Value", typeof(string));
dt.Columns.Add("Maximum Value", typeof(string));
int count = ds.Tables[0].Rows.Count;
for (int i = 0; i < count; i++)

[code]...

hows hould i round up while binding..?

View 1 Replies

Data Controls :: GridView Export To Excel - Round Decimal Numbers To Two Decimal Places

May 7, 2015

I was read your post: "Export GridView to Excel in ASP.Net with Formatting using C#" and is very useful. That code works perfect. But I need create a new format for a specific column in my sheet before to export it. For example:My DataTable have a column with decimal numbers and I'm trying reduce the tenths for each number.I want this: 2,874444 ----> 2,87 for a specific range. In this case I need it for all numbers in the column 13 or well said for the Column called N in Excel. Only reduce two tenths.

I used:

xlWorkSheet.Range["N"+h,"N"+h].NumberFormat = "0.00";

And no works (h is for rows, N is the column. Into a foreach).

View 1 Replies

DataSource Controls :: Decimal Values Not Updating With Decimal Places?

Apr 6, 2010

I'm trying to execute this statement every minute with SQL Agent, I have it set up as a job:

[Code]....

It's trying to update a column which data type is set to decimal. Just so you know what I really need out of it, here is an example:

[Code]....

The answer of which should add on 0.5 to the original value. If I were to use the increase value of 60 which then becomes 60/60 it will work.I'm dividing by 60 because the increase value is per hour so I make it smaller to get per minute value. Why is it doing this?

View 2 Replies

C# - Doing A Math.Round(x,2) On A Decimal Value, But Need To Ensure 2 Numbers After Decimal As Its Money

Mar 3, 2010

Some values are returning 2.0 but I need it to be 2.00 as this is a money value that is displayed to the web page.

I am doing:

Math.Round(value, 2);

Is there a way to force it to 2 numbers after the decimal?

View 3 Replies







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