Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > ADO Data > Update an SQL d...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 14 Topic 4253 of 4320
Post > Topic >>

Update an SQL database

by =?Utf-8?B?TWVhdA==?= <Meat@[EMAIL PROTECTED] > Jun 23, 2008 at 12:00 PM

Hi,

I want to update a record into a SQL server 2000 database.  When I want to

compare my variable with the record in the database, I can't say why but
it's 
not working, the script continues without doing what I want it to do : 

Dim strServerName

strServerName = "servername"

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open "Provider=SQLOLEDB;Data Source=SERVER;Initial 
Catalog=DATABASE;User ID=USER;Password=PASSWORD"

objRecordSet.Open "SELECT * FROM TABLE", objConnection, adOpenStatic, 
adLockOptimistic

objRecordSet.MoveFirst

Do Until objRecordSet.EOF = true
If objRecordSet.Fields("Server") = strServerName Then
    WScript.Echo strServerName
    WScript.quit
Else
    objRecordSet.MoveNext
End if
Loop

The problem is with the "If objRecordSet.Fields("Server") = strServerName 
Then" line.  Even if both variable are the same, it doesn't do the 
WScript.Echo strServerName.

What could be the problem?

Thank you.
 




 14 Posts in Topic:
Update an SQL database
=?Utf-8?B?TWVhdA==?= <  2008-06-23 12:00:30 
Re: Update an SQL database
"Bob Barrows [MVP]&q  2008-06-23 15:31:22 
Re: Update an SQL database
=?Utf-8?B?TWVhdA==?= <  2008-06-25 06:08:04 
Re: Update an SQL database
"Daniel Crichton&quo  2008-06-25 14:13:31 
Re: Update an SQL database
"Bob Barrows [MVP]&q  2008-06-25 09:42:51 
Re: Update an SQL database
"Daniel Crichton&quo  2008-06-25 16:26:30 
Re: Update an SQL database
=?Utf-8?B?TWVhdA==?= <  2008-06-25 10:36:04 
Re: Update an SQL database
"Bob Barrows [MVP]&q  2008-06-25 13:45:51 
Re: Update an SQL database
=?Utf-8?B?TWVhdA==?= <  2008-06-26 08:30:00 
Re: Update an SQL database
"Bob Barrows [MVP]&q  2008-06-26 11:52:47 
Re: Update an SQL database
=?Utf-8?B?TWVhdA==?= <  2008-06-26 11:00:01 
Re: Update an SQL database
"Bob Barrows [MVP]&q  2008-06-26 14:14:28 
Re: Update an SQL database
=?Utf-8?B?TWVhdA==?= <  2008-06-27 05:09:01 
Re: Update an SQL database
"Daniel Crichton&quo  2008-06-26 17:15:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 15:32:21 CST 2008.