Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Invalid column name error

Posted on 2003-10-24
3
Medium Priority
?
311 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 680 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 320 total points
ID: 9616292
this will also work.
[last name]
0
 
LVL 42

Assisted Solution

by:frodoman
frodoman earned 680 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

721 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