aditya immadi

aditya immadi

  • NA
  • 205
  • 71.3k

Conversion failed when converting the nvarchar value 't5sxdb

Oct 18 2013 3:10 AM

Hai all,i have a small problem here.

 protected void Page_Load(object sender, EventArgs e)
        {
             string id = System.Web.HttpContext.Current.Session.SessionID;

            if (IsPostBack==false)
            {

                string connn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
                SqlConnection con = new SqlConnection(connn);
                con.Open();
                string str = "select decription,url from tb_userdata inner join tb_userlogin on tb_userdata.uidfromtb1=tb_userlogin.id where tb_userlogin.id=@id";

                SqlCommand cmd = new SqlCommand(str,con);
                cmd.Parameters.AddWithValue("@id", id);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill(ds);...............at this line i got this error

Conversion failed when converting the nvarchar value 't5sxdbfbcwlpfsdmv4t1amyx' to data type int.

                DataList1.DataSource = ds;
                DataList1.DataBind();
            }


and my table is
CREATE TABLE [dbo].[tb_userdata](
[id] [int] NOT NULL,
[uidfromtb1] [int] NOT NULL,
[Name] [nvarchar](max) NULL,
[decription] [nvarchar](max) NULL,
[url] [nvarchar](max) NULL
) ON [PRIMARY]

i thoght evrythibg is fine .what is wrong with my code.anyone help me out

Thanks and Regards

Answers (2)