Column Does Not Belong To Table Random Error
Contents |
ACTIVITIES If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To column does not belong to table c# datatable start viewing messages, select the forum that you want to visit from the selection
Column Does Not Belong To Table Defaultview
below. Results 1 to 17 of 17 Thread: [RESOLVED] Column 'Columnname1' does not belong to table ACTIVITIES Tweet Thread Tools Show
Column Does Not Belong To Table Table C#
Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jun 13th, 2008,02:15 PM #1 kiran_q8 View Profile View Forum Posts Thread Starter Lively Member Join Date Apr
Column Does Not Belong To Table Sql
2006 Location CA, USA Posts 81 [RESOLVED] Column 'Columnname1' does not belong to table ACTIVITIES Hi, I am using C# .net 1.1. I am having problem in the code below... DataRow[] dr = dataset1.Tables[0].Select("User_Code='kiran'"); TextBox1.Text = dr[0]["olumnname1"].ToString(); foreach(DataRow drVac in dr) { td.Text = drVac["Columnname1"].ToString(); } It gives me an error message "Column 'Columnname1' does not belong to table ACTIVITIES" even tough I am not having table ACTIVITIES in my whole column does not belong to underlying table c# application. Any help please.... Reply With Quote Jun 13th, 2008,02:24 PM #2 riteshjain1982 View Profile View Forum Posts Frenzied Member Join Date Jan 2006 Posts 1,875 Re: Column 'Columnname1' does not belong to table ACTIVITIES check for this (bold) TextBox1.Text = dr[0]["olumnname1"].ToString(); foreach(DataRow drVac in dr) { td.Text = drVac["Columnname1"].ToString(); __________________ Rate the posts that helped you Reply With Quote Jun 13th, 2008,02:26 PM #3 riteshjain1982 View Profile View Forum Posts Frenzied Member Join Date Jan 2006 Posts 1,875 Re: Column 'Columnname1' does not belong to table ACTIVITIES if thats not the cause of problem try to post column name of dataset1.Tables[0] __________________ Rate the posts that helped you Reply With Quote Jun 13th, 2008,02:31 PM #4 kiran_q8 View Profile View Forum Posts Thread Starter Lively Member Join Date Apr 2006 Location CA, USA Posts 81 Re: Column 'Columnname1' does not belong to table ACTIVITIES Actually in my code that is the not the columnname. I just handwritten the code as a sample to explain the situation... and it errors out at the bolded lines DataRow[] drVacReplacement = dsVacReplacement.Tables[0].Select("User_Code='" + dr["assignee"].ToString() + "'"); tr = new TableRow(); td = new TableCell(); td.CssClass = "VOCtdVacReplacement"; td.Text = "Priority " + dr["priority"].ToString(); tr.Cells.Add(td); td = new TableCell(); hlUserName = new HyperLink(); hl
(3) If an error such as column
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies http://stackoverflow.com/questions/14283937/column-x-does-not-belong-to-table-server-error-why of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a does not minute: Sign up Column [X] does not belong to table server error - why? up vote 1 down vote favorite I've been using this same one line code to save a specific field from my database to a variable. variable = Convert.ToType(dt.Rows[0]["[Column Name]"]); Problem is i'm getting this annoying column doesn't exist server error. This is happening for different tables and different does not belong fields with sql queries as simple as "Select * From Table". I've checked countless of times that the column name is correct , i tried with space in the column name and without - nothing seems to help. Any idea what's causing this and how to solve it? Here is the stack trace: [ArgumentException: Column '[Long MSDS Update]' does not belong to table Table.] System.Data.DataRow.GetDataColumn(String columnName) +5253191 System.Data.DataRow.get_Item(String columnName) +13 SiteMaster.msds_update() in c:\Users\nravid\Desktop\School\Project\PhillipsSite\Site.master.cs:198 SiteMaster.master_Page_PreLoad(Object sender, EventArgs e) in c:\Users\nravid\Desktop\School\Project\PhillipsSite\Site.master.cs:92 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnPreLoad(EventArgs e) +121 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +699 Thanks. c# asp.net mysql sql-server sql-server-2008 share|improve this question asked Jan 11 '13 at 17:56 Ned 1682616 Is the specified column name correctly spelled? You should also double-check your query is retrieving from the right table. –codingbiz Jan 11 '13 at 18:03 add a comment| 3 Answers 3 active oldest votes up vote 5 down vote accepted You were getting this error because you included the brackets [ ]. Remove the square brackets and it should work Use dt.Rows[0]["Column Name"] Instead of dt.Rows[0]["[Column Name]"] In your case dt.Rows[0]["Long MSDS Upd