(variable name) is neither a DataColumn nor a DataRelation for table Table

dymnDrync

New Member
This is my code for taking data from the database (i use dataset) :\[code\]public DataSet getJobVacancy(GetJobVacancyData data){ try { string _SPName = "dbo.SearchJob"; SqlParameter[] sqlParam = new SqlParameter[3]; sqlParam[0] = new SqlParameter("@Keyword", SqlDbType.VarChar, 25); if(data.Keyword == null || data.Keyword == "") sqlParam[0].Value = http://stackoverflow.com/questions/11760260/DBNull.Value; else sqlParam[0].Value = data.Keyword; sqlParam[0].Direction = ParameterDirection.Input; sqlParam[1] = new SqlParameter("@LocationID", SqlDbType.SmallInt); if(data.LocationID == null) sqlParam[1].Value = http://stackoverflow.com/questions/11760260/DBNull.Value; else sqlParam[1].Value = data.LocationID; sqlParam[1].Direction = ParameterDirection.Input; sqlParam[2] = new SqlParameter("@ExperienceYears", SqlDbType.TinyInt); if(data.ExperienceYears == null) sqlParam[2].Value = http://stackoverflow.com/questions/11760260/DBNull.Value; else sqlParam[2].Value = data.ExperienceYears; sqlParam[2].Direction = ParameterDirection.Input; return SqlHelper.ExecuteDataset(SystemConfiguration.AMDP2_ConnectionString, CommandType.StoredProcedure, _SPName, sqlParam); } catch (Exception ex) { throw ex; }}\[/code\]And this is my setter-getter :\[code\]public string JobVacancyID { get; set; }public string PostingDate { get; set; }public string ClosingDate { get; set; }public string Position { get; set; }public string Location { get; set; }public string Keyword { get; set; }public string LocationID { get; set; }public string ExperienceYears { get; set; }\[/code\]This one is my Repeater's data bound :\[code\]protected void rptJob_ItemDataBound(object sender, RepeaterItemEventArgs e){ if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView data = http://stackoverflow.com/questions/11760260/(DataRowView)e.Item.DataItem; Literal ltrDatePosted = (Literal)e.Item.FindControl("ltrDatePosted"); Literal ltrClosingDate = (Literal)e.Item.FindControl("ltrClosingDate"); LinkButton lbtnPosition = (LinkButton)e.Item.FindControl("lbtnPosition"); Literal ltrLocation = (Literal)e.Item.FindControl("ltrLocation"); Literal ltrExpYears = (Literal)e.Item.FindControl("ltrExpYears"); Literal ltrJobVacancyID = (Literal)e.Item.FindControl("ltrJobVacancyID"); ltrDatePosted.Text = data["PostingDate"].ToString(); ltrClosingDate.Text = data["ClosingDate"].ToString(); lbtnPosition.Text = data["Position"].ToString(); ltrLocation.Text = data["LocationName"].ToString(); ltrExpYears.Text = data["ExperienceYears"].ToString(); ltrJobVacancyID.Text = data["JobVacancyID"].ToString(); //this is where the error occured }}\[/code\]This is my sql query/stored procedure (i have run this query and the JobVacancyID column is in the result) : \[code\]BEGINSELECT JobVacancyID, PostingDate, ClosingDate, Position, b.LocationName, ExperienceYears FROM TRJobVacancy aJOIN LTLocation b on a.LocationID = b.LocationID WHERE Position LIKE '%'+ COALESCE(@Keyword,Position) + '%' AND COALESCE(@LocationID, a.LocationID) = a.LocationID AND COALESCE(@ExperienceYears,ExperienceYears) = ExperienceYears\[/code\]The error that i got is : "JobVacancyID is neither a DataColumn nor a DataRelation for table Table"And the confusing fact's are :1. It's only give an error at data["JobVacancyID"], the others is smooth.2. I think i don't have a table named Table(the error said this)Thanks :D
 
Back
Top