473,387 Members | 3,820 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,387 software developers and data experts.

update statement troubles

here is my trouble - i have 3 pages, the first runs a simple querey and populates a drop down list, the user picks one of the returns and upon submission is sent to the second page - there the user can modify certin fields, once they click on submitting changes the third page takes the modified data, strips out single quotes and updates the table and displays the information that was supposedly written to the table. here is the code on the third page

Dim Comments

Comments = Request.Form("NewComments")

Dim cnnSimple
Dim rstSimple
Dim strDBPath

Comments = Replace(Comments, "'", "")

strDBPath = Server.MapPath("ProjectsReport.mdb")

Set cnnSimple = Server.CreateObject("ADODB.Connection")

cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

Set rstSimple = cnnSimple.Execute("UPDATE tblProjects SET Comments = '" & Comments & "' WHERE Project = '" & ProjectName & "'")


Now here is the trouble, the values are passed ok, displayed ok, querey appears to work however the table is not updated - any suggestions.
Oct 25 '06 #1
3 2056
albertw
267 100+
here is my trouble - i have 3 pages, the first runs a simple querey and populates a drop down list, the user picks one of the returns and upon submission is sent to the second page - there the user can modify certin fields, once they click on submitting changes the third page takes the modified data, strips out single quotes and updates the table and displays the information that was supposedly written to the table. here is the code on the third page

Dim Comments

Comments = Request.Form("NewComments")

Dim cnnSimple
Dim rstSimple
Dim strDBPath

Comments = Replace(Comments, "'", "")

strDBPath = Server.MapPath("ProjectsReport.mdb")

Set cnnSimple = Server.CreateObject("ADODB.Connection")

cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

Set rstSimple = cnnSimple.Execute("UPDATE tblProjects SET Comments = '" & Comments & "' WHERE Project = '" & ProjectName & "'")


Now here is the trouble, the values are passed ok, displayed ok, querey appears to work however the table is not updated - any suggestions.
hi

can't you use

With datReport.Recordset
.Edit
'make changes code
.Update
End With

datReport.Refresh

where datReport is the dataconnection to ProjectReport.mdb
???
Oct 25 '06 #2
scripto
143 100+
here is my trouble - i have 3 pages, the first runs a simple querey and populates a drop down list, the user picks one of the returns and upon submission is sent to the second page - there the user can modify certin fields, once they click on submitting changes the third page takes the modified data, strips out single quotes and updates the table and displays the information that was supposedly written to the table. here is the code on the third page

Dim Comments

Comments = Request.Form("NewComments")

Dim cnnSimple
Dim rstSimple
Dim strDBPath

Comments = Replace(Comments, "'", "")

strDBPath = Server.MapPath("ProjectsReport.mdb")

Set cnnSimple = Server.CreateObject("ADODB.Connection")

cnnSimple.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

Set rstSimple = cnnSimple.Execute("UPDATE tblProjects SET Comments = '" & Comments & "' WHERE Project = '" & ProjectName & "'")


Now here is the trouble, the values are passed ok, displayed ok, querey appears to work however the table is not updated - any suggestions.

As per your code, ProjectName seems to be blank??
and why are you using a recordset? this is an update statment - try just executing the command
Oct 25 '06 #3
willakawill
1,646 1GB
As per your code, ProjectName seems to be blank??
and why are you using a recordset? this is an update statment - try just executing the command
Also you don't need to check the database to see if the update worked. Put a Long variable after your SQL statement and check it for the number of rows affected by your code:
Expand|Select|Wrap|Line Numbers
  1. cnnSimple.Execute("UPDATE tblProjects SET Comments = '" & Comments & "' WHERE Project = '" & ProjectName & "'", lngRowsAffected)
  2.  
  3. If lngRowsAffected = 0 Then
  4.    MsgBox "Oh Dear! Something amiss with my SQL programming again"
  5. End If
  6.  
:)
Oct 26 '06 #4

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

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
4
by: MaRcElO PeReIrA | last post by:
Hi there, I was in troubles with a UPDATE+IN statement: The following command use to take about 5 minutes to be done: UPDATE requisicao SET conclusao='3' WHERE reg IN (SELECT reg FROM...
1
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into...
16
by: vbnetdev | last post by:
hi all, This code works to add a nameserver to a container in DNS using vb.net and WMI. Howeer the code below that to add host records such as WWW and to add an MX record does not. It ojects...
2
by: travhale | last post by:
in a new project using .net 2005, c#. getting err message "Update requires a valid UpdateCommand when passed DataRow collection with modified rows." source RDBMS is oracle 8i. I add a new...
0
by: troyblakely | last post by:
I have a gridview which is pulling data from a SqlDataSource, the select command queries a view and the update command is a stored procedure. I'm using a stored procedure because several tables...
0
by: Nesa | last post by:
Hi, I am accessing DB2 8.2 (Windows) via JDBC type 4 and am having troubles making Blob.setBinaryStream(long) work to update a BLOB column. Here is the excerpt of code that I am using: ...
3
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID...
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: 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:
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
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
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...

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.