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

updating access 2000 mdb from asp.net Microsoft.Jet.OLEDB.4.0 ???

I am able to add new records with insert and delete records just fine,
but when I go to update nothing happens. Below is the asp.net vc code
in question.

Public Sub UserGrid_Update (Source As Object, E As
DataGridCommandEventArgs)
Dim objConn as new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=c:\webroot\db.mdb")
Dim cmd As OleDbCommand = new OleDbCommand ("UPDATE tbl SET
responsible=@responsible,status=@status,waitingon= @waitingon,comments=@comments
WHERE chain=@chain", objConn)
Dim schain As String = e.Item.Cells(2).Text
Dim sresponsible As String = CType(e.Item.Cells(3).Controls (0),
TextBox).Text
Dim sstatus As String = CType(e.Item.Cells(4).Controls (0),
TextBox).Text
Dim swaitingon As String = CType(e.Item.Cells(5).Controls (0),
TextBox).Text
Dim scomments As String = CType(e.Item.Cells(6).Controls (0),
TextBox).Text
response.write(schain+"-"+sresponsible+"-"+sstatus+"-"+swaitingon+"-"+scomments)

cmd.Parameters.Add(new OleDbParameter("@chain", schain))
cmd.Parameters.Add(new OleDbParameter("@responsible",
sresponsible))
cmd.Parameters.Add(new OleDbParameter("@status", sstatus))
cmd.Parameters.Add(new OleDbParameter("@waitingon", swaitingon))

cmd.Parameters.Add(new OleDbParameter("@comments", scomments))
Try

objConn.Open()
cmd.ExecuteNonQuery()
objConn.Close

Catch ex As Exception
response.write(ex.Message & ex.stacktrace)
End Try

Thanks for any help or information.

Nov 13 '05 #1
4 2000
Are you sure that this code is actually running? Is this procedure set
to handle the UpdateCommand in your page? Did you set the event
handler for the EditCommand (normally sets the EditItemIndex for the
datagrid)?

Bill E.

Nov 13 '05 #2

bi********@netscape.net wrote:
Are you sure that this code is actually running? Is this procedure set to handle the UpdateCommand in your page? Did you set the event
handler for the EditCommand (normally sets the EditItemIndex for the
datagrid)?

Bill E.

Yes, the response.write displays all the changed and expected values.

Nov 13 '05 #3
I can make the update work with fixed values. all the s variables are
getting set, only the @chain gets set however, all others @varialbes
either revert back or are never passed to the update. any idea?

Nov 13 '05 #4
Honestly, I've never used a SQL Syntax like that where I've combined
parameter names (not values) into a SQL String. I would recommend
creating a stored query for the update with a name (i.e.,
qryUpdateChain) and the parameters as you have them. Then run this as
a stored procedure by setting cmd.CommandType =
CommandType.StoredProcedure. This initialization of the command then
becomes

Dim cmd As OleDbCommand = new OleDbCommand ("qryUpdateChain", objConn)

cmd.CommandType = CommandType.StoredProcedure

See if your parameters are passed properly in this case.

Bill

ja***@cyberpine.com wrote:
I can make the update work with fixed values. all the s variables are
getting set, only the @chain gets set however, all others @varialbes
either revert back or are never passed to the update. any idea?


Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
1
by: ErickR | last post by:
We are experiencing a problem with Sql Server 2000 linking to an Access 97 file. We have two machines that link to this .mdb file, and we recently upgraded one to newer hardware, SP3a, MDAC 2.8,...
1
by: Mahesh Hardikar | last post by:
Hi , I have been trying to connect to access database from SQL Server 7.0. This machine is having 7.0 as a default instance and 2000 as a named instance. Also the machine doesn't have access...
2
by: Irvin | last post by:
I new to ASP.net and am using the following code to attempt to update an Access 2000 mdb. The code does make it through the code following "try". NO rows are updated. There is a row with the...
9
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access...
1
by: Harry Devine | last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept correctly. My grid shows values from 5 database fields. I only need to update that last 4 fields. The last field is a...
1
by: jason | last post by:
The guts of the below asp.net vb code was pieced together from another thread - all due credit to it's original author. Thank you! I've modified it to maintain a small local Microsoft 2000...
5
by: aaron.m.johnson | last post by:
I have an application which contains an Access database with linked tables that point to another database within the application. The problem I have is that when the user installs the application,...
5
by: Peter | last post by:
Hi, i've got an older Access program, which is written in the version 2000 and i'd like to use it with my new office 2007, so access 2007. In the program, there is an replication written with...
9
by: O | last post by:
I need to do some lookups and updates on some legacy Access 2.0 files (they've from another vendor and I'm not in a position to update them). I was successful using VB6, but I've moved on to VS...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.