.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Storing and retrieving in scientific notation

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :Sql Server
Hi, I am using SQL Server 2005 Express edition. I need to store and retrieve values in a scientific notation in the database. For that purpose I have taken the column datatype as Float. But to my surprise when I insert values which have scientific notation in the table, it rounds off the value and stores and thus while retrieving the values I get the rounded value and not the scientific notation value. e.g. When in an Insert statement, I give a value -5.31E+02, it stores the value in the database as -531. Even a simple select statement like "SELECT -5.31E+02" gives the result as -531. Am I missing anything here ? Can anybody please tell me how do I store and retrieve value in the same notation I give while inserting the data ?

View Complete Post

More Related Resource Links

Storing and retrieving historic data

Hi, I am looking at making my database historic and would like some pointers. Data older than 1 year does not need to be kept so every 12 months, data is "recycled". So far I have come up with the following using DATEPART and all data is in the same table (tables simplified): 1. When I insert records: INSERT INTO [Table] VALUES (newid(), @FKID, @Value, GETDATE()) 1. When I update records: UPDATE [Table] SET [Column] = @Value WHERE [FK] = @FKID AND (DATEPART(month, GETDATE()) = DATEPART(month, [TimeStamp])) 2. When I select records: SELECT * FROM [Table] WHERE [FK] = @FKID AND (DATEPART(month, GETDATE()) = DATEPART(month, [TimeStamp])) 3. WHEN I delete records: DELETE FROM [Table] WHERE [FK] = @FKID AND (DATEPART(month, GETDATE()) = DATEPART(month, [TimeStamp]))   Is this efficient? I was looking at partitioning, but I am not sure that it would be feasible as I want to recycle data every 12 months. Or is there a better way to do it? Regards, James

C# Format Double to Scientific Notation in propertyGrid



    I have a property grid on a Windows Form. One of the properties requires the number to be in scientific format. If I enter -8760 how can I format this to -.876E+4 in the property grid?



     return _myDouble;




      myDouble = value;




InfoPath 2010 - decimal field (2digit) converting large number to scientific notation


Hi Everyone,

I hope there is a simple solution to this issue.

We have built an InfoPath form for the web. Data from the form is mapped and written to SQL Server 2008 tables. The values are retrieved when the form is reopened. The form is accessed world wide and uses various currency types. Some of the values that we need in the decimal fields are quite large, e.g. 999,999,999,999,999.00. (we don't use currency sign because different curencies use different signs.)

When the amount shown is entered and saved an error occurs and the values have been converted to scientific notation. The field lengths are long enough for the value but still the scientific notation appears. The largest number that I've been able to enter without it converting is 9,999,999,999.00.

Any thoughts on how this conversion to scientific numbers can be prevented. This only occurs on a web based form.

Thanks in advance for your assistance.



Richard D. Lucky Quatier

Retrieving a variable from a previous page



I'm looking to have a search page where a user will select an item from a listview, then then taken to another page that wil display data based on their original selection.

A user will type in a string and be presented with a list of usernames that are like that string, when they select a user name who's profile they would like to view I would like the page that they're taken to, to be that users profile.

How would I transfer the variable from the search page to the profile page, and when I work on the profile page, how can I access that variable?


Storing User Data



I'm trying to get the current logged in UserId Value, using this code

Protected Sub UserProfileDataSource_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles UserProfileDataSource.Selecting      ' Get a reference to the currently logged on user      Dim currentUser As MembershipUser = Membership.GetUser()      ' Determine the currently logged on user's UserId value      Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid)      ' Assign the currently logged on user's UserId to the @UserId parameter      e.Command.Parameters("@UserId").Value = currentUserId End Sub

But, I getting an error (NullReferenceException), I did set a url authorization on the page that i try to get the logged in user information, witch is info.aspx, and I made the login.aspx control to be redirected to the info.aspx after the login process, But the info.aspx  only shows me (access in denied), how can i make this page knows that i am already logged in?

Serializing XML and storing as XML in Database


Hi All,

I know this may sound a daft question but I'm wanting to save Serialized XML into a databse but for the life of me I cant do it.

So far I have my class

public static void SerializeToXML(Candidate candidate)
            XmlSerializer serializer = new XmlSerializer(typeof(Candidate));
            TextWriter textWriter = new StreamWriter(@"C:\movie.xml");            
            serializer.Serialize(textWriter, candidate);

This basically save the serialized properties in the Candidate class into the movie.xml file which is great but I want it to return XML (so it can be re-used) so I can store the XML in the XML database field

Any help would be greatly appreciated



C# In-Depth: Harness the Features of C# to Power Your Scientific Computing Projects


The C# language has been used quite successfully in many kinds of projects, including Web, database, GUI, and more. One of the last frontiers for the application of C# code may well be scientific computing. But can C# measure up to the likes of FORTRAN and C++ for scientific and mathematical projects?In this article, the author answers that question by looking at the .NET common language runtime to determine how the JIT compiler, Microsoft intermediate language, and the garbage collector affect performance. He also considers C# data types, including arrays and matrices, along with other language features that play an important role in scientific computing applications.

Fahad Gilani

MSDN Magazine March 2004

Web Q&A: Storing SQL Data, URL Query Length, and More


Find out the best way to store large amounts of XML data in SQL Server, along with the performance implications. What's the maximum length of an XML query to SQL Server in a URL?

Edited by Nancy Michell

MSDN Magazine May 2003

Problem getting applicaton to run after retrieving it from source control software.


I am restoring my asp 2.0 app from a source control project to my local drive.

The application was originally created on a different PC but was created with Visual Studio 2005,

ASP.net 2.0.

The source control add-in (Harvest) is not working correctly so I retrieving and saving my web app

outside of Visual Studio.

I finally put all the pieces of the web app back together but now when I compile my app I get the following message:

Build (web): Could not load the assembly 'App_Web_myApplication.master.cdcab7d2'. Make sure that it is compiled before accessing the page.

Will I have to start over ?

Thanks for your insights !

"An error occurred while retrieving data from Oracle Instance..."


I have succeffuly Imported the ADF and have also successfully created a Business Data Column. But when I try to query data , I get the following error

An error occurred while retrieving data from Oracle Instance. Administrator, see the server log for more information

And this is what I found in the Application Logs
A Metadata Exception was constructed in App Domain '/LM/W3SVC/81256521/ROOT-1-129217212004078822'. The full exception text is: LobSystem could not be found using criteria 'id=476'.

Storing .EXE Files in SharePoint



   New to SharePoint.  We just started migrating directories to our SharePoint server, and have encountered an issue storing .EXE files.  The error message says that it is denied by the administrator, however our IT team believes you can not store .EXE in SharePoint and that it is a system limitation.

   Could someone please confirm whether or not there is a restriction for the storage of .EXE files in SharePoint?  

   If this is just an administrator setup issue, is there a doc that would direct us how to remore this setting?

Thank you,


storing Session in sql server?



I want to show all the activities of the logged in user in a gridview. I am using VS 2010. please suggest some good ways of doing it.



Generating and storing html pages in User Directories on the server



I come from corporate asp.net development, and I am now working on a public website which will get a lot of traffic, perhaps a million users a day.  So I am faced with a ton of performance and scalability questions.

I would like to share some thoughts and see if my approaches resonate with any good practices, or perhaps I am heading down the wrong path...  Either way, I want to hear opinions.

(My number one concern is the fact that I am using asp.net for a public website.  I don't know of a lot of websites using asp.net)

I am using asp.net 2.0 (I know, its not the latest technology but I don't need any advanced features of asp.net 3.5 or 4, unless there are significant improvements geared towards what I am doing) 

On launch date, this will be running on a dedicated Windows Server 2008 running on Intel ATOM 330 1MB L2 Cache 1.6Ghz Dual-Core with 2GB DDR RAM.  Its fully managed by a full service hosting company which gives me an option to upgrade to a bigger server within a few hours.  I can even move the site to a webfarm if the traffic demands it.

So I have a User Dashboard, where users can create albums and upload pictures.  So what I am doing

Storing data into property

Hi, I have written a property globally on page load i am storing setting some value into that property but on button click i am not able to retrieve the data. Is there any alternate way to save the data other than viewstate or sessionstate. Ex: Partial Class _Default Inherits System.Web.UI.Page Private s As String Public Property Test() As String Get Return s End Get Set(ByVal value As String) s = value End Set End Property Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then s = "Test" End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click s = "Champ" End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox(s.ToString()) End Sub End Class

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local appl

Hi ,From the last few days I am struggling with the error "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed."I hav created an asp.net web application with membership shcema. It works fine an my developement machine but when I published it on my web server. It is giving me above error for which I searched but not found any help.Can anyone help me with this.

Retrieving all multiple matches, not just the last one

Hello all, I am having a major brain cramp. I need to process a line similar to the following: Price Between 10 And 20 Or Price Between 40 And 50 Or Price Between 70 And 80 (Price Between \d+ And \d+) matches the first one. Then something like ( Or \1)* should match zero or more repeating between statements iwth a preceding Or. But I can't get the pattern setup correctly. Any ideas and/or suggestions would be greatly appreciated!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend