SQL Convert Error

Posted on 2010-08-18
Medium Priority
Last Modified: 2013-11-27
I am using Visual Studio 2008

I am having problems with the SQL query for my datasource.

This the query in question:
SELECT        inc.Title AS Incident, inc.Description, inc.CustomerID, tech.Name AS TechName, prod.Name AS Product, cust.Name AS Customer, CONVERT([varchar](11),                       inc.DateOpened, 101) AS DateOpened, CONVERT([varchar](11), inc.DateClosed, 101) AS DateClosed
FROM            (((Incidents inc INNER JOIN
                         Technicians tech ON inc.TechID = tech.TechID) INNER JOIN
                         Products prod ON inc.ProductCode = prod.ProductCode) INNER JOIN
                         Customers cust ON inc.CustomerID = cust.CustomerID)

Error I receive:

Error Source: Microsoft JET Database Engine
Error Message: Undefined function 'CONVERT' in expression

I am using the same database that I use in SMSS and the query works fine.
Question by:usky1
LVL 93

Accepted Solution

Patrick Matthews earned 1600 total points
ID: 33470878
CONVERT is a SQL Server function.  For Access, use Format.  For, say, mm/dd/yyyy:Format(DateClosed, "mm/dd/yyyy")

Expert Comment

ID: 33470883
I'm not sure what type of data source you are trying to connect to here, but it's possible it doesn't support the CONVERT function.

You say it works in SSMS, if that's the case is this a Microsoft SQL Server? And if so, probably best the change the Database Engine from JET to native SQL or something similar.
LVL 58

Expert Comment

ID: 33471015
If you are using Jet to connect to Sql server, there is something very wrong.
Check here for the connection string to use:


Author Comment

ID: 33471086
I am trying some of you suggestions and will let you know what I got to work. Thanks for the input.

Author Closing Comment

ID: 33496710

I miissed a binding that was set for Access instead of SQL.


Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

An ASP.NET Web Form User Control is not newly introduced in ASP.NET. In fact, it was an old technology yet still playing a role to generate web content, especially when we want to use it to have a better and easy way to control part of the web conte…
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

624 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