Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Vamsi Kalam 15 posts 35 karma points
    Oct 26, 2012 @ 18:38
    Vamsi Kalam
    0

    Pull data from SQL database and display it on Umbraco site. We are on version 4.5

    I have a requirement where I have to pull data from SQL database and display it on Umbraco site in a small section. This section has to be available to everyone who goes to the web site. There is no security attached. I was looking at the below link but it was talking about a user control and providing Membership settings. I don't think I need it. Please Advise.

  • Vamsi Kalam 15 posts 35 karma points
    Oct 26, 2012 @ 18:44
    Vamsi Kalam
    0

    Please ignore see below link comment on the above post. We are trying to insert the middle section on the above image on our website. It currently looks like this.

    www.archetypemortgage.com

     

  • Sean Mooney 131 posts 158 karma points c-trib
    Oct 26, 2012 @ 19:38
    Sean Mooney
    0

    You should be able to create .Net usercontrol that gets the data you want and renders the display. Then create a macro for the new control and place it on the homepage template

  • Vamsi Kalam 15 posts 35 karma points
    Nov 01, 2012 @ 17:07
    Vamsi Kalam
    0

    Hi Sean,

    I was able to create .Net user control and display sample static data. However when I am trying to get data for certain fields like 0.95% above from the database, the page is giving me an error. Here is my code.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    using

     

     

    System;

    using

     

     

    System.Collections.Generic;

    using

     

     

    System.Linq;

    using

     

     

    System.Data.SqlClient;

    using

     

     

    System.Web;

    using

     

     

    System.Web.UI;

    using

     

     

    System.Web.UI.WebControls;

    namespace

     

     

    HelloWorld

    {

     

    publicpartialclassHelloWorld : System.Web.UI.

    UserControl

    {

     

    protectedvoid Page_Load(object sender, EventArgs

    e)

    {

     

    if

    (!IsPostBack)

    {

     

    string FiveYSwap = null;

    // your page title here

     

    string myConnectionString = "server=MDCSQL12;database=AMC;Integrated Security=yes;";

    //you connectionstring goes here

     

    SqlCommand cmd = newSqlCommand("SELECT MAX([ InterestRateSwap Ask]) AS Expr1 FROM AMCSwap$ WHERE ([ InterestRateSwap Symbol] = 'USDIRSAN05Yv_03M')" + FiveYSwap.Replace("'", "''") + "'", newSqlConnection

    (myConnectionString));

    cmd.Connection.Open();

    labelPrice.Text = cmd.ExecuteScalar().ToString();

     

    // assign to your label

    cmd.Connection.Close();

    }

    }

    }

    }

    Please Advise.

  • Vamsi Kalam 15 posts 35 karma points
    Nov 01, 2012 @ 17:22
    Vamsi Kalam
    0

    Actually I figured out the problem with my code.. Its working now. Thanks

Please Sign in or register to post replies

Write your reply to:

Draft