.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

Data collections to SQL and back

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :ASP.Net

Ok I hope you uys can help. I have a bunch of pages and I use Session variables because it is the best way for me to get at what was selected from where ever on the site.

Now when I was in Classic ASP world I would be able to save what was in the Session into a SQL table. Then when the user comes back, they would be able to recreate that session (or any other they have used in the past). My question is this. In ASP.NET/C# I user the System Collections to get what the user selects on any given pull down menu. My problem is when I save the session in to SQL I get "System.Collections.Generic.List`1[System.Web.UI.We" something like that.

Now I know I can loop through and get the value of the collection. That data looks normal "2000Z *2000X8 *2000X9 *2000A *2000B *2000B1 *2000C" but how can I put what is in the DB back into the listbox as selected? 


when the user currently goes back to the page i do the following:



if (Session["CatGrpList"] != null){

View Complete Post

More Related Resource Links

Data Binding: Give Your Everyday Custom Collections a Design-Time Makeover


In this article, Paul Ballard shows how you can provide data binding support for your custom collections to enable sorting, searching, and editing in as simple a manner as possible. In addition, he shows how to make all of these features available in the Windows and Web Forms Designers, just like an ADO.NET DataSet.

Paul Ballard

MSDN Magazine August 2005

Cutting Edge: Collections and Data Binding


When it's time to design the Data Access Layer (DAL) of your distributed Microsoft® . NET Framework-based app, one of the key decisions you'll make is how you'll pass data to and from methods of DAL classes.

Dino Esposito

MSDN Magazine May 2005

Multiprocessor Optimizations: Fine-Tuning Concurrent Access to Large Data Collections


Application performance involves more than just speed. In a Web server environment, top performance also means ensuring that the maximum numbers of users can be served concurrently. This can be accomplished through efficient use of multiprocessor machines and thread management. This article presents techniques that can solve a number of concurrency problems. One approach, using thread management, controls access to a database on a per-thread basis, which protects the integrity of the data. In the article, reusable thread classes are built and presented. The classes are then tested and their performance in a live environment is examined.

Ian Emmons

MSDN Magazine August 2001

Errors in the back-end database access module. OLE DB reported an overflow of the data type for colu

Getting an error when processing a dimension, Errors in the back-end database access module. OLE DB reported an overflow of the data type for column 0. Errors in the OLAP storage engine: An error occurred while the 'xxxxxx' attribute of the 'Dim XXXXXX' dimension from the 'XXXXXXX' database was being processed. Content of this dimension is very similar to one that is processing no problem. The content of the dimension is one field only of type date.  The original content was imported through SSIS from a DB2 database on an iseries machine.  Thought a first the issue was because of the data contains some null values but the dimension the process OK also has some null  values.  The dimension that processes ok is also a single field of type date. Any help greatly appreciated, Roscoe

Rendering Partial view postback with data posted back and entire view context

This is the base Index.aspx view:<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <%@ Import Namespace="LMWebUI.Components" %> <%@ Import Namespace="LMWebUI.Models" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <% Session["HasScripts"] = "false"; %> <% if (Utility.FixNull(Session["LoggedIn"],"false") == "false" ) {%> <% ViewData["Login"] = new PartialRequest ( new { controller = "Account", action = "LogIn" } ); ((PartialRequest)ViewData["Login"]).Invoke(ViewContext); %> <%} else {%> <div>Logged In Content here</div> <%}%> <script type="text/javascript"> LMx.init(); </script> </asp:Content> This is a helper class> that I found elsewhere, doesn't solve the problem, but still works to display the viewpublic class PartialRequest { public RouteValueDictionary RouteValues { get; private set; } public PartialRequest(object routeValues

Passing data to the client and back - best way?

I'm ok (I think) with using a data bound Custom Control on the server to get hold of my data (it will be part of a larger dataset) and to ultimately pass updates to the database.  The bit I'm researching at the moment is passing that data to and from the client. One way to pass the data to the client is to use JSON within the Pageload event to construct a set of Javascript objects (one per row in the data).  Is that the best way, or am I missing something? Then, after the data has been manipulated on the client, I need to pass the rows back again so that the server side code can pick them up and process the updates.  I've seen a suggestion on here that a hidden text field is one way to do that.  Is it the best? Neither of my approaches seem to be at all elegant - and I suspect that I am missing something fundamental in ASP .NET AJAX! Thoughts welcome, Thanks, Nick

Say if ajax is forbidden on the client side,how can we still get the requred data back?

    <p>        <%using (Ajax.Form("ExamineTextBox", new AjaxOptions { UpdateTargetId = "result" }))         { %>             <%= Html.TextBox("textBox1")%>             <input type="submit" value="Button"/>              <span id="result"/>      <% } %>     </p>code slice of a sample view page(notice "Ajax.Form"):  <p>       <%using (Ajax.Form("ExamineTextBox", new AjaxOptions { UpdateTargetId = "result" }))        { %>            <%= Html.TextBox("textBox1")%>            <input type="submit" value="Button"/>             <span id="result"/>     <% } %>    </p>But if ajax request functionality is disabled/forbidden on the client side, I still wanna carry on the request , maybe in a normal http request way(mean refresh the whole page instead to at least get the data back). Is it

How to send data back to the datasource?

I have an ObjectDataSource which has two methods - GetData which gets data from the database and returns an array of Classes, and UpdateData which takes an array of Classes and updates the database.  The array of Classes contains sufficient information to allow UpdateData to work out what it needs to do.  So, to get an update to work, all I need to do is pass the [amended] array of Classes back to the ObjectDataSource via the UpdateData method. Then I have a control which inherits from DataBoundControl.  The control is happily using PerformSelect and PerformDataBinding to make the data available.  As it happens, I'm also implementing IScriptControl and throwing most of the data to the Browser as JSON for processing as a Javascript array.  I've got to the point where, on a PostBack, the data arrives back on the server and the control gets the array into the state where it is ready to update. Then, I need to pass the array of Classes over to the ObjectDataSource (the converse of the PerformSelect).  I was expecting to see a PerformUpdate or similar function within DataBoundControl.  At that point, I have juddered to a stop - and can't find anything which talks about how to get the data source to update. I'm, probably missing something obvious - and actually hope that I am! Thanks, Nick

problem when passing data from view back to controller?


I have following situation - I am pasing user info object from Controller to View. It contains GUID UserID,  which i dont want to be seen on page.

So I  removed every   Html.LabelFor(model => model.UserID), Html.TextBoxFor(model => model.UserID) etc... from generated View source.

And because of this when Html.BeginForm() returns that object back to Controller  all values is there but UserID is lost??

If I leave Html.LabelFor(model => model.UserID), Html.TextBoxFor(model => model.UserID) etc.. in View everything is fine.

But I dont want to show UserID?

Where is the problem here?

                <%= Html.LabelFor(model => model.C__User_Id) %>

Recover data on a Previous Page after navigating from the page and navigating back

How can i recover the data on Page1 after navigating to Page2, so that when i navigate to Page1 from Page 2 i want the unsaved data as is.

Getting error message and other data back from SSIS to managed code




From a SharePoint workflow we are trying to synchronously execute an SSIS package - which seems to work - and display error messages and return some variables back to SharePoint.


I followed the "Running a Package Remotely by Calling a Remote Component or Service" instructions on http://msdn.microsoft.com/en-us/library/ms403355.aspx and executing and parameterizing the package does not seem to be a problem. But the SSIS package does a lot of plausibility checking and raises an error (RAISERROR in T-SQL or Error

Converting raw RGBA data back into an image.


I have been using a programme called Momento (which is a photobook programme - see www.momento.com.au if relevant).  With out boring you with the details I have lost all of my original data and am unable to recover it.

The programme did store image cache files in my application data and these appear to be related to the original picutres.  These files have names like 0dfc15fead0908ed2176d0d46e165614 and dont have file extensions.  Some are quite large - 3-4 GB which is consistent with the original pics.  There is also a file of thumb cache and these are DAT files.  Neither open with Momento.  I have been in touch with Momento support and they are unable to assist me other than to tell me the image cache files are raw RGBA data.

Obviously what I need to know is can I convert these files back to some sort of image and if so how and/or what programme can I use?  Is there a techincal service that could do it for me for a fee?

Thanks in advance


Convert XML back to relational data - How?


Hi all,

I would like to convert an rss xml feed back into a relational data table format.

I would need to do the SELECT based on the pubDate as I would only want  the current days rss.

My pseudo-code would be:

INSERT INTO tblRSS("title","description","pubDate")
SELECT title,description,pubDate FROM 'myRSSfeed' WHERE pubDate = "todays date'

Sorry, I don't know any XQuery, so I'm really lost on this one.

Thanks for any help.


<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:georss="http://www.georss.org/georss" xmlns:twitter="http://api.twitter.com">
    <title>Twitter / corkweddings</title>
    <atom:link type="application/rss+xml" rel="self" href="http://twitter.com/statuses/user_timeline/86177082.rss"/>
    <description>Twitter updates from Cork Weddings  / corkweddings.</description>
    <title>corkweddings: Balloons for all your parties - 8

Is it possible SQLXML to accept the Base64Binary data type and convert it back to binary to a 'ntex


Hi, I am trying to pass to SQLXML ("SQLXMLBulkLoad.SQLXMLBulkload.4.0") an XSD schema to be able to accept the Base64Binary data type and convert it back to binary to a 'ntext' type field(Due to a legacy DB that sore some Binary data at a 'ntext' field at SQL Server)

I have try the following without success:

'<xsd:attribute name="Mybase64field" type="xsd:base64Binary" sql:datatype="image" />'

Is this possible?

Passing data credentials back to the data layer


I have an N-Tier ASP.NET application that uses an Oracle back end and has to use Oracle Users to authenticate. I need to be able to pass these users back to the database to log in. I really do not want create parameters in each and every method for this purpose. Can someone give me some ideas on how I might pass these credentials back to the datalayer for db authentication purposes?

Using ASP to connect, post and get back data from MySQL DB



I'm a retired social worker creating some eLearning lessons and have a lesson that saves to a MS SQL Server DB, using ASP. I also have a component file in the lesson that can post/get back data but usually does this using PHP and a MySQL DB. The tutorial to help beginners like me provides PHP scripts compatible with the MySQL DB. But I need to post/get back data from a MS SQL Server DB and if possible use ASP for this.

I have the PHP scripts from the tutorial, and I've tested these with a sample MySQL DB. They work. What I need to do is "translate" the PHP into ASP so I can instead use a MS SQL Server DB which already is set up in the eLearning lesson.

I've seeached and searched, tried many sample scripts, connection strings. Nothing has worked.

I am posting the insert.php, select.php and delete.php scripts for a test project set up with a MySQL DB from the tutorial, in the hope that someone can suggest a way to "translate" these into working ASP versions that I can use with my MS SQL DB. I alos know that the connection string for the MS SQL Server DB uses OLE DB, but I already have this configuration from the eLearning lesson. (I don't know ehere to put it in an ASP script.)



$first = $HTTP_POST_VARS['first'];
$last = $HTTP_POST_VARS['last'];
$address = $HTTP_POST_VARS['address'];

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.
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