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

Updating a database

Hey guys i was wondering if you could help me update a database,

I have connected a access database to a MS Chart tool which creates a bar graph (that works). What i want to do is say whatever is in this array element or screen element to equal that row in the database.

Here is the code which i haev currently generated

Public strPlayersNames(16) As String [In a module]
Public nudTotalMeters(16) As Integer [In a module]
Public con As New OleDb.OleDbConnection("Provider = Microsoft.Jet.OleDB.4.0;Data Source = rl.mdb;") [In a module]
Imports System.Data
Imports System.IO
Imports System.Data.OleDb

Dim adp As New OleDbDataAdapter("select *from playermeters", con)

Dim ds As New DataSet
adp.Fill(ds)
Dim dt As DataTable
dt = ds.Tables(0)

dt.Rows(0).Item(0) = strPlayersNames(0)
dt.Rows(0).Item(1) = nudTotalMeters(0)

dt.Rows(1).Item(0) = strPlayersNames(1)
dt.Rows(1).Item(1) = nudTotalMeters(1)

dt.Rows(2).Item(0) = strPlayersNames(2)
dt.Rows(2).Item(1) = nudTotalMeters(2)

(and it goes on)

Thankyou
Jun 24 '07 #1
6 1087
can anyone help me please?
Jun 26 '07 #2
kenobewan
4,871 Expert 4TB
Please define "whatever is in this array element or screen element to equal that row in the database." Thanks
Jun 26 '07 #3
Please define "whatever is in this array element or screen element to equal that row in the database." Thanks
dt.Rows(0).Item(0) = strPlayersNames(0) thats what i mean. But its not updating at all could you please help me
Jun 26 '07 #4
kenobewan
4,871 Expert 4TB
Please paste more of your code so that we may see what is going on. Thanks.
Jun 27 '07 #5
Please paste more of your code so that we may see what is going on. Thanks.
Okay so ive updated the code . I 100% know that the database is connected becuase when i call a row into a text box it displays whatevers in that row into the text box. But the problem which i am having is when i click on button1 to update the database this error message comes up "Object reference not set to an instance of an object".

Public Class frmNewGameStatistics
Dim con As New OleDb.OleDbConnection("Provider = Microsoft.Jet.OleDB.4.0;Data Source = rl.mdb;")
Dim ds As New DataSet
Dim adp As New OleDb.OleDbDataAdapter '("select *from playermeters", con)
Dim sql As String
Dim dt As DataTable
Dim cb As New OleDb.OleDbCommandBuilder(adp)
Dim dsNewRow As DataRow


Private Sub frmNewGameStatistics_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.Open()
sql = "select *from playermeters"
adp = New OleDb.OleDbDataAdapter(sql, con)
adp.Fill(ds, "playermeters")
dt = ds.Tables(0)
con.Close()

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

dsNewRow = ds.Tables("playersmeters").NewRow()
dsNewRow.Item("Player Name") = TextBox1.Text
ds.Tables("playersmeters").Rows.Add(dsNewRow)
adp.Update(ds, "playermeters")

End Sub
Jun 27 '07 #6
does anyone know what the problem is?
Jun 28 '07 #7

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: gaosul | last post by:
I am non-programming scientist and I am using a Program called Easyarticles from Synaptosoft Inc., which is based the database program Access. Unfortunately, the owner of this company has...
3
by: Bucko | last post by:
How important do you guys feel locking a database is while updating/adding information? Do you do it with every app you make? Only very high volume (traffic) apps? I'm trying to decide if my app...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
1
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... ...
3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
10
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1)...
2
by: Alexey.Murin | last post by:
The application we are developing uses MS Access 2003 database (with help of ADO). We have noticed that during massive records updating the size of the mdb file increases dramatically (from 3-4 to...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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
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
jinu1996
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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.