?
Solved

sql statement for access database from vb.net

Posted on 2009-04-01
6
Medium Priority
?
176 Views
Last Modified: 2012-05-06
I keep getting an error when trying to get data from an access database when I use the order by clause - ierrorinfo.getdescription failed.  Any ideas?
0
Comment
Question by:ddepuemd
[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
  • 2
  • 2
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24038308
Perhaps if you posted your SQL and VB code, a solution could be more easily determined.
0
 

Author Comment

by:ddepuemd
ID: 24038336
sql = "select * from tools where job = '5687568' order by position,number"
        Try
            With dbAdaptr
                Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand(sql, cn)
                cmd.CommandType = CommandType.Text
                .SelectCommand = cmd
                .Fill(ds, "tools")
            End With
        Catch ex As Exception
            Dim str As String = ex.Message
        End Try
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24038361
Try putting "number" in brackets. "Number" is a reserved word (a data type name) in Access.

sql = "select * from tools where job = '5687568' order by position,[number]"
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 48

Accepted Solution

by:
jpaulino earned 1000 total points
ID: 24038393
A number doesn't need commas (if it's a number) and also use kaufmed suggestion about the brackets
sql = "select * from tools where job = 5687568 order by [position],[number]"
 
 
0
 

Author Comment

by:ddepuemd
ID: 24038581
yeah, I realized the key word problem and changed the table field names..
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24038747
any other problem ?
0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

752 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