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


Top 5 Contributors of the Month
ASPEvil
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Post New Web Links

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

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

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");
        dataAdapter1.Fill(dset);

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


View Complete Post


More Related Resource Links

accessing values from a database with datalist?

  

I have a datalist and I am filling it using a dataadapter, dataset. So in my .ascx page, I have

<asp:datalist runat="server" id="dlProducts" repeatcolumns="2" repeatdirection="horizontal">

<itemtemplate>

<table border="0">

<tr><td><%# Eval("Item_Name") %></td></tr>

<tr><td>I have to add a picture here</td><td><%# Eval("First_Name") %></td></tr>

</table>

</itemtemplate>

</asp:datalist> 

In the area where I have put a statement like "I have to add a picture here", I have write a big case statement.  Like:

Case: 6 // show a picture from file1

case: 7 // show a picture from file2

Case 8: //show a picture from file3

 

So How do I do this here?  Because I dont know how to access the datalist values from code behind.

 

Here is my code behind:

SQLString = "SELECT First_Name, Picture, item_name, item_id from table1 where item_id = " + request.querystring["iid"];

dataadapter daItems = new dataadapter(SQLString, "connection_name");

dataset dsItems = new dataset();

daItems.fill(dsItems);

dlProd

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

  

Hi,

 

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

http://www.dotnetcurry.com/ShowArticle.aspx?ID=129&AspxAutoDetectCookieSupport=1

 

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.

 

Thanks


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 retrive client name ,Field , and Image from Database and show in datalist?

  

hi experts,

i wanat to display Client Name, Field and  image in datalist. Stored Procedure like this

ALTER proc [dbo].[get_clients_services]
as
SELECT     Clients.ClientName AS Client, Fields.FieldName AS Field, ServiceType.ServiceType AS Services, ServiceType.Servicelink AS Link, 
                      Clients.ClientLogo AS Logo
FROM         Clients INNER JOIN

Datalist not displaying image from database

  

My database table contains the image file path which will be stored from a
file upload control.The image path in the table will be like "C:\Projects\projectname\projectfolder\Files\1_129308367798080000_images1.jpg"


I am trying to display that image through a datalist control as follows
<asp:DataList ID="cobrandlogolist" runat="server">
               <ItemTemplate>
                <asp:Image id="CobrandLogo" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "CobrandLogo") %>' Height="100px" Width="100px"
                 runat="server"/>

               </ItemTemplate>
               </asp:DataList>

and i am retrieving the image names from the db and assigning as datasource of this datalist in the load event as follows

    DataTable dt = new DataTable();
          

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

  

Hay,

SqlConnection sqlConnection = new SqlConnection(
    "Server=SRVRNAME;Database=DATASOURCE;uid=USRNAME;pwd=PASS;");
      sqlConnection.Open();
      string datasourceName =getDatasourceDatabaseName(ASPxComboBox1.SelectedItem.Text,kpConn);
      ServerConnection srvrConnection = new ServerConnection(sqlConnection);
      srvrConnection.Connect();
      Server srvr = new Server(srvrConnection);
      Database db = new Database(srvr, datasourceName);
 
      ASPxListBox1.Items.Clear();
      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.

Retrieve DLL Items From Database

  

Hello,

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();
                

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.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

  
We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

  
This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.

Adding Multiple Columns and Rows in GridView without using a Database

  
This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

Categories: 
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