View Single Post
  #7 (permalink)  
Old March 3rd, 2009, 04:59 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

hi thanks for the translation ,
i have an error saying that i miss a using directive or assembly reference.
i have imported system.data.sqlclient, what else i need to import?
this is the page

Code:
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
publicpartialclass_Default : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionString("Minds").ConnectionString);
SqlCommand cmdd = newSqlCommand("Select HomeLeft from Home");
SqlDataReader dr = null;
cmdd.Connection = con;
con.Open();
dr = cmdd.ExecuteReader();
dr.Read();
if (dr.HasRows == true)
{
this.Label1.Text = dr.gettext(dr.getcolumnofset("HomeLeft"));
}
con.Close();
}
 
}
i want to take the HomeLeft column that has Nvarchar(50)dt and display it in Label1, HomeLeft is Column number 2 in the table, so getcolumnofset should be replaced with what?
thanks
__________________
bx