473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to retrieve all the data?

37
Hi there,
I'm having problems retrieving data from Access database using Visual basic 2005. My database is called Actual_Database and it has a few tables. One of them is called Threshold Database. I'm trying to retrieve data from Threshold Database. In that table, it has columns of AC250L, AC250R, BC250L, BC250R, AC500L etc.. When i select a name from the combo box, and click presentButton, it will show a smile if the values from the database is more than a variable called count. I managed to retrieve only for AC columns and I couldn't retrieve BC columns. Why is that? Here's my codes..

Private Sub presentButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles presentButton.Click

Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Rihanna\Desktop\BIE\Actual Database.mdb;Jet OLEDB:Database Password=****"

con.Open()

sql = "SELECT * FROM ThresholdDatabase"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Actual_Database")

con.Close()

s = Me.NameComboBox.SelectedIndex

'AC
left250 = ds.Tables("Actual_Database").Rows(s).Item("AC250L" )
right250 = ds.Tables("Actual_Database").Rows(s).Item("AC250R" )
left500 = ds.Tables("Actual_Database").Rows(s).Item("AC500L" )
right500 = ds.Tables("Actual_Database").Rows(s).Item("AC500R" )

'BC
leftBC250 = ds.Tables("Actual_Database").Rows(s).Item("BC250L" )
rightBC250 = ds.Tables("Actual_Database").Rows(s).Item("BC250R" )
leftBC500 = ds.Tables("Actual_Database").Rows(s).Item("BC500L" )
rightBC500 = ds.Tables("Actual_Database").Rows(s).Item("BC500R" )

If Me.acRadioButton.Checked = True Then
If count >= leftAC250 Then
Me.PictureBox1.Visible = True
tmrTimer.Interval = 1000
tmrTimer.Enabled = True

ElseIf count >= leftAC500 Then
Me.PictureBox1.Visible = True
tmrTimer.Interval = 1000
tmrTimer.Enabled = True
.
.
.
End If
End If

If Me.bcRadioButton.Checked = True Then
If count >= leftBC250 Then
Me.PictureBox1.Visible = True
tmrTimer.Interval = 1000
tmrTimer.Enabled = True

ElseIf count >= leftBC500 Then
Me.PictureBox1.Visible = True
tmrTimer.Interval = 1000
tmrTimer.Enabled = True
.
.
.
End If
End If


End Sub


Thanks =))
Jul 29 '07 #1
0 1423

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Chung Leong | last post by:
My contribution to the comp.lang.php FAQ: ------------------------------------------------------------- Q: How do I retrieve a page from a web site? A: Pass a URL to file() or...
5
by: David Rasmussen | last post by:
Some sites seem to be session driven in the sense that if I visit the homepage and do a few clicks I can navigate anywhere I want, but if I paste the current location into a new browser window...
2
by: forums_mp | last post by:
I've got an STL class (see below) with two functions to store and retrieve data - msg structs. The "Store" function when called will copy the received message (depending on which message) into...
4
by: Claudia Fong | last post by:
Hi, I have a form where I need to display the data of a department that stores in a access db. When I first load the form it will call a function name loaddata which will get the first...
6
by: lovecreatesbeauty | last post by:
/* It seems that when an int with width of four bytes is assigned to a one byte width char, the first three bytes from left to right are discarded and the rightest byte is assigned to that char....
13
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end...
9
by: trint | last post by:
How can I retrieve all of the data from a datagridview? Any help is appreciated. Thanks, Trint
1
by: Mel | last post by:
Anyone know how I would retrieve the MaxLength property of a column in my Access Database table? I know how to retrieve table data, for example the "Quote #" field in my example code below, but I...
9
by: Mel | last post by:
I have 10 columns total. 3 of them are invisible. The rest are read- only BoundFields, 3 of which are editable fields using TemplateFields. Upon editing, I want to validate what the user enters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.