Solved

Invalid column name error

Posted on 2003-10-24
3
309 Views
Last Modified: 2010-05-19
I am having a problem with an error message.
When I try to drag the last name field from the table under Cottages(this is the name of the database on SQL Server from MSDE it was taken from a student files disk), I get an error message:
 
Data Adapter Configuration Error
 
The wizard detected the following problems when configuring the data adapter for "Guests".
Details:
 Generated SELECT statement
 
Invalid column name 'Last'
 
I can cancel or click OK
When I click OK, I get the Connection and Data Adapter Components in the component tray.  I can name them.
But when I try to generate the dataset, I get another error message.
 
Microsoft Development Environment
 
Retrieving the schema for daLastName failed
 
Invalid column name 'Last'
 
I can click cancel or OK
 
When I click OK I get the Generate Dataset box
I can name the dataset, but there are no tables to choose from in the box below
I am in the design view of the guests( I will be adding textboxes and a combo box to display info from the database) form. The guests form is a child form
What am I doing wrong
Thanks, Kay
0
Comment
Question by:wait3264
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

Assisted Solution

by:frodoman
frodoman earned 170 total points
ID: 9616244
The problem is that "last" is a reserved word for SQL Server / MSDE.  

The easiest fix is to rename the table "last name" to "last_name" or "LastName".  This way the table name won't be parsed into two pieces.

Note however that this will break any triggers or stored procedures that referenced this table so they'll need to be fixed (there probably aren't any though because they would likely have already choked on the 'last').
0
 
LVL 4

Accepted Solution

by:
NetPointer earned 80 total points
ID: 9616292
this will also work.
[last name]
0
 
LVL 42

Assisted Solution

by:frodoman
frodoman earned 170 total points
ID: 9616685
NetPointer,

The brackets will work if you're writing the code by hand but it sounds like Kay is using Visual Studio and dragging the table.  This means the IDE is throwing an error right away.  

Of course you can still edit the sql manually but why bother with drag-n-drop if you're going to that?

Frodoman
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WPF user control poped up from a window 1 51
T-SQL and CLR parameter strings 9 64
CSS question 16 63
Help with viewing image in ReportViewer 14 29
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question