Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 3rd, 2004, 09:06 AM
shanny shanny is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 35 shanny User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 50 sec
Reputation Power: 5
Question .edit is invalid in ado connection??

I am trying to write the code for record updating, the following msg pop up:

Method or data member not found.

Here is my coding:

Set rst = New adodb.Recordset
rst.Open "Member", db, adOpenDynamic, adLockOptimistic
rst.Edit

rst("ID") = txtLecID.Text
rst("Name") = txtLecName.Text
rst("Address") = txtLecAdd.Text
rst("CIty") = txtCity.Text
rst("PostCode") = txtPCode.Text
rst("State") = cboState.Text
rst("Tel") = txtLecTel.Text
rst("Room") = txtRoom.Text
rst("Email") = txtEmail.Text
rst.Update
MsgBox "Data Updated!", vbExclamation, "Inform"

Why the rst.edit is debuging? .edit is not a invalid function??

Reply With Quote
  #2  
Old December 3rd, 2004, 10:46 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
just remove the rst.Edit line...it isn't valid.

Reply With Quote
  #3  
Old December 3rd, 2004, 11:33 AM
shanny shanny is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 35 shanny User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 50 sec
Reputation Power: 5
if i remove the rst.edit, then a msg pop up saying that this consist of error because it will generate duplicate data.

Note that: ID is set to be the primary key. what is the solution for that??? hope advise ...thanks.

Reply With Quote
  #4  
Old December 4th, 2004, 12:56 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 32 m 23 sec
Reputation Power: 180
If ID is an autonumber don't try to edit it from code.

If ID is not an autonumber you have to do some coding to prevent trying to use duplicate values.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #5  
Old December 4th, 2004, 09:47 AM
shanny shanny is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 35 shanny User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 50 sec
Reputation Power: 5
ID is set to be the primary key in the database. i have created a form that allow user to do registration. In some cases, user may need to change thier personal information. so there is a edit button. But the coding cannot work.

I need help from u all... thanks

Reply With Quote
  #6  
Old December 30th, 2004, 03:59 AM
spida spida is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 2 spida User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool no need to write .edit

There is no need to use .edit coz normallly ado are in edit mode. just enable the fields and make changes to what eva u want, but while update use SQL update statement instate of updating ADO. Hope dis helps u

Reply With Quote
  #7  
Old January 2nd, 2005, 05:41 AM
djlah djlah is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 djlah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Code:
Private Sub modify()
ErrorFlag = True
Call ErrorTrapper
Set rs = db.OpenRecordset("Select * from University_Master where U_Code = '" & lblCode.Caption & "'")
If ErrorFlag = True Then
	lblName.ForeColor = vbBlack
	rs.edit
	rs("U_Name") = txtName.Text
	rs("U_Address_1") = txtAdd1.Text
	rs("U_Address_2") = txtAdd2.Text
	rs("U_Address_3") = txtAdd3.Text
	rs("U_Address_4") = txtAdd4.Text
	rs("U_District") = txtDistrict.Text
	rs("U_Country") = txtCountry.Text
	rs("U_State") = txtState.Text
	rs("U_Pin") = txtPin.Text
	If txtWeb.Text = Empty Then
		rs("U_WebSite_Name") = "Not Available"
	Else
		rs("U_WebSite_Name") = txtWeb.Text
	End If
	If txtMail.Text = Empty Then
		rs("U_Email_Address") = "Not Available"
	Else
		rs("U_Email_Address") = txtMail.Text
	rs("U_Phone") = txtNumber.Text
	End If
	If txtHistory.Text = Empty Then
		rs("U_Brief_Story") = "Not Available"
	Else
		rs("U_Brief_Story") = txtHistory.Text
	End If
	If cmbISO.Text = "Certified" Then
		rs("U_Is_ISO") = "True"
	Else
	If cmbISO.Text = "Not Certified" Then
		rs("U_Is_ISO") = "False"
	End If
	End If
	rs.Update
	lblIns.Caption = "Record successfully modified."
	statusBar.Panels(4).Text = "Data saved."
	saved = True
	Set rs = db.OpenRecordset("University_Master", dbOpenDynaset)
	Call List
Else
	Call StatusError
End If
End Sub

this is my vb code for Ms.Access, how to convert the code for SQL. I also remove the .edit but after the next line also is debugging, why?

Reply With Quote
  #8  
Old January 2nd, 2005, 05:02 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 32 m 23 sec
Reputation Power: 180
You appear to be using DAO code, and I don't think SQL Server is supported by DAO (I don't really know, imho DAO should be avoided).

Try using ado code. ADO recordsets have no .edit method.

Reply With Quote
  #9  
Old January 3rd, 2005, 02:44 AM
djlah djlah is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 djlah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for replied, I appreciate it.
Can you compare wat's diff btw DAO and ADO code? how to change my DAO code to ADO code? or u have any recommended tutorials website?

Reply With Quote
  #10  
Old January 3rd, 2005, 10:48 AM
djlah djlah is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 djlah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Run-time error '3705':
Operation is not allowed when the object is open

What should I do? HELP

Reply With Quote
  #11  
Old January 3rd, 2005, 07:25 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 32 m 23 sec
Reputation Power: 180
Quote:
Originally Posted by djlah
Run-time error '3705':
Operation is not allowed when the object is open

What should I do? HELP

I don't know, maybe let someone know what code causes your error rather than hoping there are telepaths hanging around here.

Reply With Quote
  #12  
Old January 5th, 2005, 12:45 AM
shanny shanny is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 35 shanny User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 50 sec
Reputation Power: 5
Quote:
Originally Posted by Doug G
I don't know, maybe let someone know what code causes your error rather than hoping there are telepaths hanging around here.


close all database or MS Acess and try to execute it again. the program being interrupting if ur database is open. Hope it help!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > .edit is invalid in ado connection??


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 |