Solved

sql statement for access database from vb.net

Posted on 2009-04-01
6
172 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
  • 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
DevOps Toolchain Recommendations

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

 
LVL 48

Accepted Solution

by:
jpaulino earned 250 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
REXEX help Part 2 2 25
VB.Net WebRequest Code from JSON curl 9 13
VB.net and sql server 4 36
C# LINQ ForEach() question 6 28
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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