hi i have copied this from my other page where it works fine and i cant understand what is going wrong! maybe one of your guys can point out what i cant see! herei s my code
string strOrderID = Request.QueryString["orderID"].ToString();
int intOrderID =Convert.ToInt32(strOrderID);int intCustID =Convert.ToInt32(Request.QueryString["qsnOrderCustID"].ToString());
lblCustomerID.Text = Request.QueryString["qsnOrderCustID"].ToString();lblOrderID.Text = Request.QueryString["orderID"].ToString();
SqlConnection myConn =newSqlConnection("Data Source=xxxx;Initial Catalog=xxxx;User ID=xxxx;Password=xxxx");
//This is the sql statement.
string sql ="SELECT [del_address], [del_post_code], [del_time] From tbl_del WHERE order_ID = " + intOrderID;
//This creates a sql command which executes the sql statement.
SqlCommand sqlCmd =newSqlCommand(sql, myConn);myConn.Open();
SqlDataReader dr = sqlCmd.ExecuteReader();//This reads the first result from the sqlReader
dr.Read();
try
{
lblDelTime.Text =Convert.ToString(dr["del_time"].ToString);
lblDelAddy.Text = dr["del_address"].ToString();
lblDelPCode.Text = dr["del_post_code"].ToString();if (lblDelAddy.Text !=""){
lblDelDate.Visible =true;
lblDelTime.Visible =true;Label1.Visible =true;
Label2.Visible =true;}
}
catch (Exception except){
lblerror.Text =Convert.ToString(except);}
Regards
Jez
What error are you getting?
|||try
{
lblDelTime.Text =Convert.ToString(dr["del_time"].ToString);
lblDelAddy.Text = dr["del_address"].ToString();
lblDelPCode.Text = dr["del_post_code"].ToString();if (lblDelAddy.Text !=""){
lblDelTime.Visible =true;
Label1.Visible =true;Label2.Visible =true;}
}
catch (Exception except){
lblerror.Text =Convert.ToString(except);}
I can only find the above problem in the code...if you can name the error it will be more helpful for us.
|||i realised that i was being a complete idiot (thats what being up for to long does! makes you miss the obvious!) i took a look at the bigger picture, it said that the textbox wasnt being filled, so maybe a problem with the data reader, no, but because i have 2 data readers on one page and i just copied and pasted the code, i forgot to put dr2[" instead of dr["
No comments:
Post a Comment