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

Post New Web Links

Retrieve DLL Items From Database

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net


Im trying to preserved selected DropDownList Items when returning to a previous page.  I have the DDL data entered into to the DB just fine, just trying to re-select the choosen Items.  The code i have so far towards this result is:

protected void Page_Load(object sender, EventArgs e)
            if(Session["LastID"] != null)

                SqlConnection cnn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Record_Review.mdf;Integrated Security=True;User Instance=True");
                SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM tblDemographics WHERE CaseID ='" + Session["LastID"] + "'" , cnn);
                DataSet ds = new DataSet();
                da.Fill(ds, "tblDemographics");
                drpFacility.SelectedItem.Text = ds.Tables[0].Rows[0]["Facility"].ToString();
                txtReviewDate.Text = ds.Tables[0].Rows[0]["Review"].ToString();
                drpQuarter.SelectedItem.Text = ds.Tables[0].Rows[0]["Quarter"].ToString();
                txtPCN.Text = ds.Tables[0].Rows[0]["PCN"].ToString();
                DrpProgram.SelectedValue = ds.Tables[0].Rows[0]["Program"].ToString();
                txtMRNumber.Text = ds.Tables[0].Rows[0]["MR"].ToString();
                txtDOB.Text = ds.Tables[0].Rows[0]["DOB"].ToString();

View Complete Post

More Related Resource Links

LINQ to SQL - Validating if item is in Database, but if item is not items not inserting into databas



I am new to this, so bear with me.  I am writing an application in C# that uses LINQ to validate a datacontext off a textbox to see if the record exists already.  If the record does exist I inserted an if statement to advise the user that the record exists, if the record does not exist I would like to allow the record to be added to the database.  If I take out my else statement everything works fine as far as inserting goes, but I do not want to allow inserts in this scenario.  I have tried moving the if and else statement to different parts of the code but can't quite figure this one out.  Any help would be apprecaited, attached is the code.  This code is set to a button press.  As a matter of fact, if you see any other errors along the way please feel free to point them out. 



    protected void enterBTN_Click(object sender, EventArgs e)
        //make new data context

        SHCDataContext insNewAll = new SHCDataContext();
        //LINQ to check if customer exists in database
        var checkExisting = from c in insNewAll.Customers
                            where c.custLastName.Contains(custLastNameTB.Text.ToString())
                            select c.custLastName;
        //make list to store values

Retrieve cube data directly from Relational database - is this possible?

I have a cube created in SSAS R2 2008. Now i would like to retrieve some data from this cube, using MDX language, and then to process it in Relational SQL database! Is this possible? I am new in SSAS, please help!  

Suppose we are building a web-based application to retrieve and enter information into a database.

Please help me out with thisSuppose we are building a web-based application to retrieve and enter information into a database.  The user-interface invokes web services.  Which architecture  would use for the application.

Retrieve image from database




I have followed the example from this page for vb.net.



The upload works fine, but not the download. Everything is as the example but its not working. This in running in my development enviroment i.e httpL/localhost.

Do i have to configure my asp.net or something, or the image control on my web page.


Can anybody help.



retrieve large file from database ?


I have a database table that works as a file repository.  Currently there are binaries stored in there and I want to pull the "large" ones out in chunks.  Some of these files are in excess of 500 MB.  I have business rules that dictate if the file is >5MB to transmit in chunks.  <5MB and I can load into memory and rip out.  I got the uploading in chunks to work, but how do I get it to pull it out of the DB in chunks?

Right now I'm getting hit with a 'System.OutOfMemory' exception.  But when I recreate the byte array of the SAME size (empty though) it doesn't break.

Download Chunks (DAL)

public byte[] getBytesByDataID(int chunkSize, string dataID)
            string query = "SELECT data.data " +
                " FROM data " +

how to retrieve value from the database on the basis of combobox value in Datalist


Hello frnds...I want to retrieve the data from the databse on the basis of webcombo value....

protected void Page_Load(object sender, EventArgs e)
        SqlConnection sqlConnection = new SqlConnection("Data Source = DELLVOSTRO; Initial Catalog = ALPHA; User Id= sa; Password= intransit");
        string selectString = "SELECT distinct COMPANY_CODE from COMPANY ";
        SqlDataAdapter dataAdapter1 = new SqlDataAdapter(selectString, sqlConnection);
        DataSet dset = new DataSet();
        dataAdapter1.TableMappings.Add("COMPANY", "COMPANY_CODE");

        WebCombo1.DataSource = dset;
    protected void Button1_Click(object sender, EventArgs e)
        SqlConnection sqlConnection = new SqlConnection("Data Source = DELLVOSTRO; Initial Catalog = ALPHA; User Id= sa; Pas

C#: Failed to retrieve data for this request, Database.Tables



SqlConnection sqlConnection = new SqlConnection(
      string datasourceName =getDatasourceDatabaseName(ASPxComboBox1.SelectedItem.Text,kpConn);
      ServerConnection srvrConnection = new ServerConnection(sqlConnection);
      Server srvr = new Server(srvrConnection);
      Database db = new Database(srvr, datasourceName);
      foreach (Microsoft.SqlServer.Management.Smo.Table tbl in db.Tables)
        ASPxListBox1.Items.Add(new ListEditItem(tbl.Name, tbl));
I got the exception 'EnumeratorException:Failed to retrieve data for this request" when trying to retrive db tables!

Regards, GoodLuck.

Add menu items into Javascript menu from Database


First look at the coding

<script src="jq.js" type="text/javascript"></script>
<script language="JavaScript">
    function menu_001() {
        if (TransMenu.isSupported()) {

Retrieve All the items from Discussion Board List


Hi All

I am facing problem in retreiving the items from discussion board list.I wanted to loop through all the posts in discussion board and respective replies.I wanted to display all those datas programatically.I am able to retrieve all the posts in discussion board except those having reply thread .

I am using Moss2007 Object models.

If i use  splist.Folders; i will be getting all the posts.But not the replies of the post

If i use splist.items , i will be getting only those posts which are having reply thread.But not the replies of the post

Any lime light on this would be really helpful



how to fill my menu items from database ?



I have menu list like this

and I want to fill it's Items from my SQL database, is that possible ?

Web part to retrieve List Items based on configurable property


I want to create a web part that will do the following

1) Have a custom choice property based on teh Choice List Column in the list.

2) Return the records based on the custom choice selected by the user.


Is this possible?


how to retrieve data from microsoft access database using .net


i want to  know how to retrieve data from microsoft access database using vb .net

How to store and retrieve images from SQL server database using asp.net?

In this article, I will show you how to store images into sql server table and display in gridview control in the page using asp.net and sql server stored procedure.

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

jQuery: Styling DropDownList Alternating Items (Rows)

In the following example, I will show how you can style any asp:dropdownlist very easily.

The example demonstrates how you can change alternating row items background color, using the fadeTo() to add a nice touch in the dropdownlist. You can change alt rows with a couple lines.
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