.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 multiple data types in a class?

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
I need help writing a class that will contain three values per item.  I'll be passing parameters to a report: Parameter Name, Data type (int, string, date, etc), and Value. When I pass those values to the report using the class they should be in original form (i.e. an integer should be a numeric, a string should be a string, etc.).  I can do it converting the data's value to strings on one end, and reconverting to the original data type on the other, which seems like a lot of runaround. Is there a simple way?  Also, if I'm able to store & retrieve the data in it's native format I don't need the "Data type" stored. Any help or tips will be appreciated.

View Complete Post

More Related Resource Links

Storing XML data in multiple related tables at one shot


Hi, I am looking for some ways to store data in multiple related tables in one shot using the advanced features in SQL Server 2005. The store operation will always be the insertion into the different but related tables.


The scenario is something like this. I have an input XML data, on which I apply XSLT to convert them in relational format and to make it compatible with a dataset schema which I created from the related tables from the database. Then I load the refined XML data into a dataset. I am looking out for some ways to store the dataset in one shot into the database in relational format without breaking records parent-child relationship. Thanks in advance for your suggestions and feedback.


Data Types - Date and Time in SqlServer

Date and time values can be stored with either the DATETIME or SMALLDATETIME data type. The difference between the two is that SMALLDATETIME supports a smaller range of dates and does not give the same level of precision when accounting for time. The DATETIME data type can hold values from January 1st of 1753 to December 31st of 9999. The time is stored to the 1 three hundredths of a second and each value takes up 8 bytes of storage. The SMALLDATETIME data type can hold values between January 1st 1900 and June 6th of 2079. The time is tracked to the minute and each value takes up 4 bytes of storage. The majority of business applications can live happily with SMALLDATETIME, however, if you are in an environment where each second matters or you need to make estimates to the distant future (or past) then you have to resort to DATETIME. If you fail to specify the time when inserting a value into a DATETIME or SMALLDATETIME column, a default of midnight is used. If you fail to specify the date portion the default of January 1, 1900 is used.

Date and Time Data Types and Functions

The following sections in this topic provide an overview of all Transact-SQL date and time data types and functions. For information and examples that are common to date and time data types and functions

Frequently Asked Questions - SQL Server Data Types

This is good and precise introduction and Frequently Asked Questions - SQL Server Data Types

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?

data from multiple row



I have a dataset in my SSRS report where I am getting the data like this. It has 3 rows.

ID Parameter Value

1. Client Name-  XYZ

2. Client Email - xyz@s.com

3. Clinet Phone- 234567

I need to check condition in expression, so If parameter is Client name then It will show in client name textbox of Report. How can write expression for this.

Zip Your Data: Using the Zip Classes in the J# Class Libraries to Compress Files and Data with C#


Zip compression lets you save space and network bandwidth when storing files or sending them over the wire. In addition, you don't lose the directory structure of folders you Zip, which makes it a pretty useful compression scheme. The C# language doesn't have any classes that let you manipulate Zip files, but since .NET-targeted languages can share class implementations, and J# exposes classes in the java.util.zip namespace, you can get to those classes in your C# code. This article explains how to use the Microsoft J# class libraries to create an application in C# that compresses and decompresses Zip files. It also shows other unique parts of the J# runtime you can use from any .NET-compliant language to save some coding.

Ianier Munoz

MSDN Magazine June 2003

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

Building a Custom Data Grid: Performing Ad Hoc Web Reporting with a VBScript 5.0 Class Object


A flexible, customizable grid for displaying data is a useful tool for ASP developers. It allows Web visitors to customize their view of your data. This article takes the data grid presented in "Ad Hoc Web Reporting with ADO 2.0" by John Papa and Charles Caison (MIND, December 1998) and adds handy features such as a finds feature that supports multiple finds and a mode for adding and editing records. This version also improves response time by allowing asynchronous record download and it componentizes the code so it can be used as a standalone VBScript class object that can be reused in other pages.

Randall Kindig

MSDN Magazine July 2000

send data in class object from one page to another using session


hello everybody

now i hav stored all data like user name, data fatched from database of that user

and i stored that data and user name such as:

string strUserName="user name"

dataset ds =new dataset();// data of that user

now i wan yo send d whole data from my login page to user profile page

can anybody help me for that...................

and plz tell me that how much is this way is benifitial to send data from one page to another page

plz........kindly waiting for positive rply

How do you create a custom BDC data field that allows for multiple selected values?

I need help creating a custom data field using the BDC column as a base.  We need to allow for multiple selected values instead of just a single one.  I can't find anything on the net which shows how to do this.

Creating .NET Assemblies That Aggregate Data from Multiple External Systems for Business Connectivit

This article describes a quick, four-step process for creating a .NET assembly that BCS can use to retrieve external data for SharePoint Server 2010 by using Visual Studio 2010.

Add new content types to multiple libraries


We use MOSS for document management and content types for document types (i.e. specification, quote, PO etc.)).  We would like to add additional content types to our libraries.  I was hoping to find a tool that would help me to propagate these new content types ad I am not a programmer.





Hello People,

               Well i am just trying to test interoperability between ASP.net And Java web services, wanted to know what are the INTEROPERABILITY issues concering DATA TYPES that are there between the 2?...any thoughts? 

Using the single *.rpt file with multiple data sources


I've created a set of CrystalReports (*.rpt files) for an ASP.NET web app on a development server. I call each report using the following code:

protected void BTN_RunReport_Click(object sender, ImageClickEventArgs e)
CrystalReportViewer_ClientLetter.Visible = true;

ConnectionInfo con = new ConnectionInfo();
con.ServerName = Constants.ServerIP;
con.DatabaseName = Constants.DatabaseName;
con.UserID = Constants.UserID;
con.Password = Constants.Password;

CrystalReportViewer_ClientLetter.ReportSource = Server.MapPath(Constants.ClientLetters);
ParameterFields parameter = CrystalReportViewer_ClientLetter.ParameterFieldInfo;
ParameterField batchdate = new ParameterField();
batchdate.Name = "@BatchDate";
ParameterDiscreteValue batchdate_value = new ParameterDiscreteValue();
batchdate_value.Value = Convert.ToDateTime(txtBatchDate.Text);

foreach (TableLogOnInfo tlf in CrystalReportViewer_ClientLetter.LogOnInfo)
tlf.ConnectionInfo = con;

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

Data flow task with multiple destinations randomly hangs

I have a package whose control flow consisting of a single data flow task with multiple destinations continues to hang at random locations.  The data flow task is fairly simple: - One OLE DB source (one query of selecting about 10 fields from one table) - 9 lookups that serve basically as left joins to capture which data "drops off" (does a row redirect on on lookup errors to an "error flow") - Two destinations: one the captures all the data that doesn't drop off from the lookups, and another to capture the data that does drop off; these write to two tables unrelated to each other, and unrelated to any of the tables I'm reading from I have tried the following: - Changed one or both destinations from OLE DB to flat file -- still randomly hangs - Removed both destinations altogether -- this always suceeds.   - Removed destination A and leave destination B -- this always succeeds - Removed destination B and leave destination A -- this always succeeds I took great care in making sure I get no warnings when the package runs, even resolving the unneeded column warnings, and the duplicate keys on all my lookups, but it still hangs. However, once I give up and stop the package, the following error is thrown (among others that appear to be a byproduct of the root issue): Error: 0xC02020C4 at Data Flow Task, OLE_SRC AP12 [1]: The attempt to
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