473,408 Members | 1,707 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,408 software developers and data experts.

Adding New Records

37
Hi there,
I can already retrieve values from database (Microsoft Access). However, when i add new records, it won't be able to retrieve. Here's my codes:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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=D:\BIE\Sowmya.mdb;Jet OLEDB:Database Password=****"

con.Open()

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

con.Close()

s = Me.nameComboBox.SelectedIndex
left250 = ds.Tables("Sowmya").Rows(s).Item("AC250L")
right250 = ds.Tables("Sowmya").Rows(s).Item("AC250R")

Me.Label1.Text = left250


End Sub
Aug 8 '07 #1
3 1062
I may be able to help you. However, I don't understand what you are wanting to to do. Please rephrase your question.
Aug 8 '07 #2
This Code is fine for selection of records, i think u r not able to retrieve the records u have just added..
You might not be refreshing ur datset after entering the record. which means u still have the old dataset.
After Insertting, run this code again, then only u will able to get new records.
Aug 8 '07 #3
tigger
37
Sorry for not making things clear. I have a combo box that contains 10 names. For eg. I select John's name. It will retrieve his left250 value. It will then compare this value with a variable called Count. I've managed to do this so far. However, when i add in a new name in the Access database, the name in the combo box does not appear. And when i delete John's name in the database, the name in the combo box will not be deleted. When i select John when i run the program, it will show error. I did not refresh cos i published the file into an executable file (i'm using visual basic 2005 express). I guess i need to add in some codes for my combo box. Cos when i retrieve values, it will retrieve in reference to the selected index of the combo box. How do i update my combo box automatically without having to refresh my vb program?


s = Me.nameComboBox.SelectedIndex
left250 = ds.Tables("Sowmya").Rows(s).Item("AC250L")
right250 = ds.Tables("Sowmya").Rows(s).Item("AC250R")
Aug 10 '07 #4

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

Similar topics

6
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1...
10
by: Eric Petruzzelli | last post by:
If I fill my dataset and there is no data. The dataset is still created with zero rows (all columns are there). When I add my first row using the script below, it takes over 2 seconds to add??? If...
2
by: David | last post by:
Hi, I have an order form which has a field 'ProductID'. This form has a button on each record to open a new form linked by ProductID. This new form is a continuous form and obviously, only...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
2
by: Tor Inge Rislaa | last post by:
Prevent Adding new records in DataGrid Hi I have a DataGrid that I want to open for editing but the user should not be able to add new records. When I set the ReadOnly = False it is possible...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
8
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
9
by: Kadett | last post by:
Hi all, I have following problem: I'm creating a ListView (Details) control at run-time and filling it with some records (let's say 10 000). This operation seems to be quite fast, but when I call...
1
by: vbDavidC | last post by:
I am adding a new record to a table via a dataset/adapter. I have got the following to work for me but I am wondering if there is a better way to do this. I am having to have something in my...
2
by: darrel | last post by:
HI vb Wizards, good day, just wanted to ask if somebody there can help me iwth my problem. Am having difficulty in adding up records in my table, the table is in Microsoft Access format. It Like...
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.