Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using SQL with an Acess Db

Posted on 2008-10-07
1
Medium Priority
?
182 Views
Last Modified: 2012-05-05
Hi Experts,

Please look at the attached code snippet and tell me how I can assign the result of the SQL query to the integer HighScore.
Dim DbConn As OleDbConnection
Dim SQLStr As String
Dim HighScore As Integer
DbConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb")
DbConn.Open()
SQLStr = "SELECT TopScore FROM tblResults WHERE TeamID = 1;"
        
HighScore = ???     
DbConn.Close()

Open in new window

0
Comment
Question by:DColin
[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
1 Comment
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 22659074
Try this way:
Dim DbConn As OleDbConnection
Dim SQLStr As String
Dim HighScore As Integer
DbConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb")
SQLStr = "SELECT TopScore FROM tblResults WHERE TeamID = 1;"
Dim command As New OleDbCommand(SQLStr, DbConn)
DbConn.Open()
HighScore = command.ExecuteScalar()
DbConn.Close()

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

597 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