Re: Update an SQL database

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



How do you define "are the same". Remember, a string comparison is case
sensitive when just using = - so MachineID0 is not the same as machineid0.

Dan


Meat wrote on Thu, 26 Jun 2008 08:30:00 -0700:

Finally it is working well about the servername. But I get the same
one when
I try to compare the ''Machine ID''.

I need to find the server in the database to get the machine ID to be
able to search in another database to find what I'm looking for.

If strServerName = objRecordSet.Fields("Name0") Then strMachineID =
objRecordSet.Fields("MachineID")

...

So now I'm having problem with this :

'***********************************************************
If objRecordSet.Fields("MachineID") = strMachineID Then
'***********************************************************

I put the lines just like you said and I can see that both variables
are the same but the instructions under the ''If'' aren't executed...

"Bob Barrows [MVP]" wrote:

Hopefully you noticed the oversight on my part that Daniel pointed
out.
Unless you have on error resume next somewhere, the lines I posted
should have thrown errors.
So, assuming you made the correction provided by Daniel, you are
seeing messages containing the following?

Recordset contains ''

and

Variable contains ''

??


Meat wrote:
I did what you told me and both strServerName and
objRecordSet.Fields("server") shows absolutely nothing. I only get
blank message boxes with an ''OK'' button.

"Bob Barrows [MVP]" wrote:

Meat wrote:
Hello Bob,

The vbscrit isn't run by an asp page,
Hmm, I've just taken another look at your code and I'm not sure now
what made me think it was. Sorry

I run it manually on a server to see if my connection and querie
to the SQL database is working well. That's why I put those
WScript.Echo. I watch it live and I click OK when needed.

The problem I got is with this line :

Insert here:
Wscript.Echo Recordset contains '" & objRecordSet.Fields("Server")
&
"'" Wscript.Echo Variable contains '" & strServerName & "'"

**********************************************************
If objRecordSet.Fields("Server") = strServerName Then
**********************************************************

It seems that this line isn't working, because I do not see the
WScript.Echo lines after, even if I know that this condition is
true.

Do I need to convert both variables into text or any other kind of
data to be able to compare them?

I will better be able to answer after you have done the above.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will
get a quicker response by posting to the newsgroup.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.



.


Quantcast