Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Ado Connection Error

Reply
 
Old 09-26-2008   #1 (permalink)
Henrique


 
 

Ado Connection Error

Hi!

Im using this VB6 code and work fine. But When I plece it in my other
project using VBScript, dont work fine and criate un error "Class not
defined".

Samme one helpe me?

Set Cnn1 = New ADODB.Connection

StrCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Supervisao\Alarmes.mdb;Persist Security Info=False"
Cnn1.Open StrCnn

Set RST = New ADODB.Recordset
RST.CursorType = adOpenKeyset
RST.LockType = adLockOptimistic
RST.Open "Registos", Cnn1, , , adCmdTable

If Not RST.BOF Then
RST.MoveFirst
End If

RST.AddNew
RST!Data = Date
RST!Hora = Time
RST!Equipamento = "Motor 1"
RST!Alarme = "térmico"

RST.Update





My System SpecsSystem Spec
Old 09-26-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Ado Connection Error


"Henrique" <wq@xxxxxx> wrote in message
news:newscache$4sps7k$dll$1@xxxxxx
Quote:

> Hi!
>
> Im using this VB6 code and work fine. But When I plece it in my other
> project using VBScript, dont work fine and criate un error "Class not
> defined".
>
> Samme one helpe me?
>
> Set Cnn1 = New ADODB.Connection
>
> StrCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=C:\Supervisao\Alarmes.mdb;Persist Security Info=False"
> Cnn1.Open StrCnn
>
> Set RST = New ADODB.Recordset
> RST.CursorType = adOpenKeyset
> RST.LockType = adLockOptimistic
> RST.Open "Registos", Cnn1, , , adCmdTable
>
> If Not RST.BOF Then
> RST.MoveFirst
> End If
>
> RST.AddNew
> RST!Data = Date
> RST!Hora = Time
> RST!Equipamento = "Motor 1"
> RST!Alarme = "térmico"
>
> RST.Update
Replace these two statements:

Set Cnn1 = New ADODB.Connection
Set RST = New ADODB.Recordset

with this:

Set Cnn1 = CreateObject("ADODB.Connection")
Set RST = CreateObject("ADODB.Recordset")

Also, you must assign values to adCmdTable, adOpenKeyset, and
adLockOptimistic with Const statements.

Const adCmdTable = 2
Const adOpenKeyset = 1
Const adLockOptimistic = 3

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 09-26-2008   #3 (permalink)
Henrique


 
 

Re: Ado Connection Error

Ok

Work fine.

Thank you


"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> escreveu na
mensagem news:uh$5CX9HJHA.1364@xxxxxx
Quote:

>
> "Henrique" <wq@xxxxxx> wrote in message
> news:newscache$4sps7k$dll$1@xxxxxx
Quote:

>> Hi!
>>
>> Im using this VB6 code and work fine. But When I plece it in my other
>> project using VBScript, dont work fine and criate un error "Class not
>> defined".
>>
>> Samme one helpe me?
>>
>> Set Cnn1 = New ADODB.Connection
>>
>> StrCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data
>> Source=C:\Supervisao\Alarmes.mdb;Persist Security Info=False"
>> Cnn1.Open StrCnn
>>
>> Set RST = New ADODB.Recordset
>> RST.CursorType = adOpenKeyset
>> RST.LockType = adLockOptimistic
>> RST.Open "Registos", Cnn1, , , adCmdTable
>>
>> If Not RST.BOF Then
>> RST.MoveFirst
>> End If
>>
>> RST.AddNew
>> RST!Data = Date
>> RST!Hora = Time
>> RST!Equipamento = "Motor 1"
>> RST!Alarme = "térmico"
>>
>> RST.Update
>
> Replace these two statements:
>
> Set Cnn1 = New ADODB.Connection
> Set RST = New ADODB.Recordset
>
> with this:
>
> Set Cnn1 = CreateObject("ADODB.Connection")
> Set RST = CreateObject("ADODB.Recordset")
>
> Also, you must assign values to adCmdTable, adOpenKeyset, and
> adLockOptimistic with Const statements.
>
> Const adCmdTable = 2
> Const adOpenKeyset = 1
> Const adLockOptimistic = 3
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Connection error - Virginmedia Live Mail
connection error Vista mail
VB.NET application cliick-once deployment via internet - Error - Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. .NET General
all net connection 10013 error Vista networking & sharing
Re: VPN Connection...failed. The error...is 734. Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46