ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 17th, 2004, 12:04 PM
Astar Astar is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 Astar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Visual Basic, DB access, problem.

Hello. I've contact with Visual Basic Only for couple of days and have a big problem.
First I'vegot wellknow "Operation is not allowed when the object is closed" error problem
but i've read somewhere that i should delete my Set before rs = cn.Execute (sQuery, ,adCmdText)
and it worked, the value 45 is inserted into my DB Column, but now ive got another error in this line
(10094) ActiveX Automation: Object var is 'Nothing'. I dont know what to do ive spend many hours
on this without success. If someone could help me Ill be very greatfull.

Im sending u my code:

Sub Main
Dim cn As Object
Dim rs As New ADODB.Recordset
Dim sQuery As String
' Open the connection to MyDB database
Set cn = GetDataLoggerADOConn("MyDB")
sQuery = "insert into MyTable" & _
"(MyCol1)" & _
"values (45)"

' Open the recordset and caluclate the average, min or max value
rs = cn.Execute (sQuery, ,adCmdText)
If Not rs.EOF Then
rs.MoveFirst
MyCol1_Calc = rs.Fields("Average1").Value
MyCol2_Calc = rs.Fields("Average2").Value
Else
MyCol1_Calc = 0
MyCol2_Calc = 0
MsgBox GetStringFromID("ID_ErrNoData"), vbOkOnly + vbInformation, "MOVICON"
End If
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
End Sub

i think sth usefull may be on this link http://www.biglist.com/lists/xsl-list/archives/200105/msg01272.html
but i dont have enough knowledge to modify my code myself.
If someone could modyfi my code ill be very greatfull

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Visual Basic, DB access, problem.


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap