Solved

sql statement for access database from vb.net

Posted on 2009-04-01
6
174 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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