Hi there,
I need to get values from Access database and bind it to ThresholdLabel. I could not use the drag and drop method because i want the data to be displayed during button click event, not when the form loads. I have a field called AC250L from Threshold Database. So how do i go about doing that?
9 1659
Hi there,
I need to get values from Access database and bind it to ThresholdLabel. I could not use the drag and drop method because i want the data to be displayed during button click event, not when the form loads. I have a field called AC250L from Threshold Database. So how do i go about doing that?
Is it possible to explain your problem in point by point..
Is it possible to explain your problem in point by point..
Hey sorry for not making myself clear. My main aim is to select a name from the combo box and when i click a button(getButton), it will display the threshold value for that particular person. I've managed to display the values on a label. Here's my code.. Imports System.Data
Imports System.Data.OleDb
Imports System.IO
Public Class DatabaseProject
Private Sub DatabaseProject_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Actual_DatabaseDataSet.Threshold_Database' table. You can move, or remove it, as needed.
Me.Threshold_DatabaseTableAdapter.Fill(Me.Actual_D atabaseDataSet.Threshold_Database)
End Sub
Private Sub getButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles getButton.Click, AC250LLabel1.Click
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
Dim cmd As OleDb.OleDbCommand
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\BIE\Actual Database.mdb;Jet OLEDB:Database Password=****"
sql = "SELECT * FROM ThresholdDatabase"
con.Open()
cmd = New OleDb.OleDbCommand(sql, con)
Dim dataAdapter As New OleDb.OleDbDataAdapter(cmd)
dataAdapter.Fill(ds, "YourTableName")
Me.NameComboBox.DataSource = ds.Tables("Threshold Database")
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Actual_Database")
con.Close() thresholdLabel.Text = ds.Tables("Actual_Database").Rows(6).Item("AC250L" ) & "dB"
End Sub
End Class
However, when i display the data, i have to manually type which row and which item i want to retrieve it from. I don't know how to link it to my combo box. Thanks.
Hey sorry for not making myself clear. My main aim is to select a name from the combo box and when i click a button(getButton), it will display the threshold value for that particular person. I've managed to display the values on a label. Here's my code.. Imports System.Data
Imports System.Data.OleDb
Imports System.IO
Public Class DatabaseProject
Private Sub DatabaseProject_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Actual_DatabaseDataSet.Threshold_Database' table. You can move, or remove it, as needed.
Me.Threshold_DatabaseTableAdapter.Fill(Me.Actual_D atabaseDataSet.Threshold_Database)
End Sub
Private Sub getButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles getButton.Click, AC250LLabel1.Click
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
Dim cmd As OleDb.OleDbCommand
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\BIE\Actual Database.mdb;Jet OLEDB:Database Password=****"
sql = "SELECT * FROM ThresholdDatabase"
con.Open()
cmd = New OleDb.OleDbCommand(sql, con)
Dim dataAdapter As New OleDb.OleDbDataAdapter(cmd)
dataAdapter.Fill(ds, "YourTableName")
Me.NameComboBox.DataSource = ds.Tables("Threshold Database")
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Actual_Database")
con.Close() thresholdLabel.Text = ds.Tables("Actual_Database").Rows(6).Item("AC250L" ) & "dB"
End Sub
End Class
However, when i display the data, i have to manually type which row and which item i want to retrieve it from. I don't know how to link it to my combo box. Thanks.
I am not sure that you mean this. Let me assume
You want to select a particular name in combo box text area
so - sql = "SELECT * FROM ThresholdDatabase"
just change this qry to - sql = "SELECT * FROM ThresholdDatabase where AC250L like " & trim(ComboboxName.Text) &
and - thresholdLabel.Text = ds.Tables("Actual_Database").Rows(0).Item("AC250L") & "dB"
I am not sure that you mean this. Let me assume
You want to select a particular name in combo box text area
so - sql = "SELECT * FROM ThresholdDatabase"
just change this qry to - sql = "SELECT * FROM ThresholdDatabase where AC250L like " & trim(ComboboxName.Text) &
and - thresholdLabel.Text = ds.Tables("Actual_Database").Rows(0).Item("AC250L") & "dB"
Hey thanks for the reply. I tried putting in the query but it seems to have an error. da.Fill(ds, "Actual_Database") is highlighted and it says "Syntax error in FROM clause."
Hey thanks for the reply. I tried putting in the query but it seems to have an error. da.Fill(ds, "Actual_Database") is highlighted and it says "Syntax error in FROM clause."
ThresholdDatabase is a table name?
because, the select Qurey will be like - select <field1>, <field2>, <field3>, <field4> from <Table Name> where <Condition>
ThresholdDatabase is a table name?
because, the select Qurey will be like - select <field1>, <field2>, <field3>, <field4> from <Table Name> where <Condition>
I've already managed to solve the problem. Thanks. But i faced another problem. Each time i select a name in the combo box, it will appear twice and the previous name disappears. For example, i select John and click a button to display a value. When i go back to the combo box and want to select another name, i realized that John's name will appear twice. And the name before John will disappear.
I've already managed to solve the problem. Thanks. But i faced another problem. Each time i select a name in the combo box, it will appear twice and the previous name disappears. For example, i select John and click a button to display a value. When i go back to the combo box and want to select another name, i realized that John's name will appear twice. And the name before John will disappear.
I think the problem is with Load event of combo box. (if no problem, you can post it and let me Look-over to solve).
I think the problem is with Load event of combo box. (if no problem, you can post it and let me Look-over to solve).
I don't face the problem anymore. Thanks a lot for your help. Appreciate it =)
I don't face the problem anymore. Thanks a lot for your help. Appreciate it =)
Could you fill us in briefly on how you resolved it? This could be useful if someone else comes along with the same problem. (Don't worry if it's something silly - we've all been there.)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: StepH |
last post by:
Hi,
I'm building a little application, which the goal is to:
1./ Collect data via Serial line and or via a file (for playback).
2./ Display these data as graph, oscilloscope, ...
How manage...
|
by: Dan R Brown |
last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to
break up this form into several "tabbed" sections, I break up the form using <div>
tags. Each <div...
|
by: Kay |
last post by:
This function is used to display the context of a queue. I input an
integer comparing with the queue cuisine number, if cuisine number is
same as the input, it shows the context. However, it cannot...
|
by: dmiller23462 |
last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I've cobbled together the...
|
by: Stefan Finzel |
last post by:
Hi,
is there a way to change the display property on Windows Mobile 2003 SE
Mobile/Pocket Internet Explorer? See following example.
Please note: visibilty property has the same problem.
Is...
|
by: JK |
last post by:
In my win form, I'm trying to display a Crystal report with the data in my
dataset only but, if I follow the steps in this msdn page:
...
|
by: Alpha |
last post by:
Hi,
I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a
listbox that I have binded to a dataset table, "source" which has 3 columns.
I would like to display 2 of those...
|
by: Eric Keung |
last post by:
Hi all,
my case is I want to get an image from access database and I just know it's "OLE object" field type at access
I also don't know how to insert it into access
here is my code and it just...
|
by: John Phelan-Cummings |
last post by:
When I add the name of a new individual in a, bound form, it will not
display that persons name in a label control of a second unbound form.
I have a scheduling program that I am working on. ...
|
by: Terry Holland |
last post by:
I have an asp.net (1.1) application that connects to a SQL server 2000 db. I
have a stored procedure in my db that out puts data in xml format.
What I need to be able to do is display that xml...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |