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

Updating recordsets in MS SQL 2005 not working

Hi,

I have recetly migrated from SQL 2000 to SQL 2005 and certain .asp-code that was working before, is no longer working.

Retrieving, inserting, deleting recordsets are no problem, but when I try to update I run into problems.

The following code works:

Expand|Select|Wrap|Line Numbers
  1. "UPDATE tblsomething SET column_name = 'something' "
But in all my pages I have been using:

Expand|Select|Wrap|Line Numbers
  1. rs.Open "SELECT * FROM tblSomething WHERE column_name=" & RequestSomething, connection, 1,3
and then I'll list the columns

Expand|Select|Wrap|Line Numbers
  1. rs.Fields("column_name") = Request.Form("form_name")
  2. -
  3. -
  4. rs.Update
And this approach does not work. Since I am primarily a designer with programming knowledge on a need-to-know-basis, I don't know if something changed between the MS SQL versions? And I am not so keen on changing my code to the working solution in all those pages...

Since the error message is in Swedish I can't just post it but is says something about not finding the sql server in sysservers and tells me to run sp_addlinkedserver to add servers into sysservers?

Does this make any sence to anyone?

Any help appreciated.

//Jesper
May 5 '06 #1
5 5601
arbert
6
Need a little bit more to go on--such as your open statements for the database connection and the recordset.
May 7 '06 #2
Need a little bit more to go on--such as your open statements for the database connection and the recordset.
Arbert,

Thanks for your reply.

The connection is working, I can view, insert, etc recordsets from the database in SQL 2005. The problem arises when I try to update.

Connection looks generically like:

Expand|Select|Wrap|Line Numbers
  1. Set DB = Server.CreateObject("ADODB.Connection") 
  2. SQL = "driver={SQL Server};SERVER=ip-number;UID=userid;PWD=password;database=databasename"
And the recordset:

Expand|Select|Wrap|Line Numbers
  1. Set rsUpdate = Server.CreateObject("ADODB.Recordset")
  2. strSQL = "SELECT * FROM tblName WHERE ID=" & Request("ID")
  3. rsUpdate.Open strSQL, DB,1,3
Then I list the field names I wan to update:

Expand|Select|Wrap|Line Numbers
  1. rsUpdate.Fields("column_name") = Request.Form("form_name")
  2. ... etcetera
And try to update:

Expand|Select|Wrap|Line Numbers
  1. rsUpdate.Update
This exact code works towards an MS SQL 2000 database, but not MS SQL 2005 which I have with my new hosting company.

Any ideas why not? Thanks,

/Jesper
May 7 '06 #3
arbert
6
Arbert,

Thanks for your reply.

The connection is working, I can view, insert, etc recordsets from the database in SQL 2005. The problem arises when I try to update.

Connection looks generically like:

Expand|Select|Wrap|Line Numbers
  1. Set DB = Server.CreateObject("ADODB.Connection") 
  2. SQL = "driver={SQL Server};SERVER=ip-number;UID=userid;PWD=password;database=databasename"
And the recordset:

Expand|Select|Wrap|Line Numbers
  1. Set rsUpdate = Server.CreateObject("ADODB.Recordset")
  2. strSQL = "SELECT * FROM tblName WHERE ID=" & Request("ID")
  3. rsUpdate.Open strSQL, DB,1,3
Then I list the field names I wan to update:

Expand|Select|Wrap|Line Numbers
  1. rsUpdate.Fields("column_name") = Request.Form("form_name")
  2. ... etcetera
And try to update:

Expand|Select|Wrap|Line Numbers
  1. rsUpdate.Update
This exact code works towards an MS SQL 2000 database, but not MS SQL 2005 which I have with my new hosting company.

Any ideas why not? Thanks,

/Jesper

Ouch. I know it doesn't directly answer your question, but why are you performing an update like that??? It's slow and has a lot of overhead--you should think about passing a CONN.EXECUTE statement or best yet--use a stored proc for the update.

Brett
Perfect Computing, Inc
May 16 '06 #4
Did you find a solution to this problem? I've just come up against the same thing. I'd prefer not to have to rewrite lots of old code just now.
Jun 7 '07 #5
debasisdas
8,127 Expert 4TB
Did you find a solution to this problem? I've just come up against the same thing. I'd prefer not to have to rewrite lots of old code just now.

Hi
gardnose
Welcome to TSDN.

You have reached the right place for knowledge shairing.

Here you will find a vast resource of related topics and code.

Feel free to post more doubts/questions in the forum.

But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

It will help Experts in the forum in solving/underestanding your problem in a better way.

Please follow the posting guidelines in every new post/reply.
Jun 7 '07 #6

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

Similar topics

5
by: Iain Porter | last post by:
Hi, I'm trying to store large strings to a database, so am using the text field type (LongText). I have used this before when storing the html of a webpage, and was able to store more than 255...
3
by: Ryan.Chowdhury | last post by:
This is a general question regarding the use of view and stored procedures. I'm fairly new to databases and SQL. I've created a SQL database using an Access Data Project ("ADP") and I'm...
3
by: Julia Härtfelder via SQLMonster.com | last post by:
Hi All! I need help with a Statement! I am working with an Access2000 DB. I have the following Problem. ChNr Linie Datum Code 39 Stückzahl BHL1 BHL2 BMRH...
5
by: Wim Van der Elst | last post by:
Hello, I want to start working in VB.net but seem to have trouble in understading how I get to an equivalent of a recordset as in VB6. The only examples I find are working with binding, but that...
14
by: el_sid | last post by:
Our developers have experienced a problem with updating Web References in Visual Studio.NET 2003. Normally, when a web service class (.asmx) is created, updating the Web Reference will...
16
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and...
34
by: Jeff | last post by:
For years I have been using VBA extensively for updating data to tables after processing. By this I mean if I had to do some intensive processing that resulted in data in temp tables, I would have...
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...
13
by: mfreeman | last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown below. All I do is loop through the records in the table and update them without making any changes. Out of 600 records, about...
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...
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
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
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
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,...

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.