Reply

Join Date: Jan 2005
Posts: 1
Reputation: jksmithyuk is an unknown quantity at this point 
Solved Threads: 0
jksmithyuk jksmithyuk is offline Offline
Newbie Poster

Addnew problem

 
0
  #1
Jan 26th, 2005
Im wondering if anyone can suggest a solution to my problem. Im simply trying to connect to a database through VB 6 and add a new record and populate one of the fields.
Any help would be great.


The code below throws up error message 'Current Recordset does not support updating. This may be a limitation of the provider or of the selected locktype'


Dim adoConnection As ADODB.Connection
Dim adoRecordset As ADODB.Recordset
Dim connectString As String
Dim RecordSQL As String

RecordSQL = "SELECT * From Programme"

Set adoConnection = New ADODB.Connection
Set adoRecordset = New ADODB.Recordset

connectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\MyDatabase.mdb"
adoConnection.Open connectString
adoRecordset.Open RecordSQL, adoConnection

adoRecordset.AddNew
adoRecordset!UserName = txtProgrammeNumber.Text
adoRecordset.Update

adoRecordset.Close
adoConnection.Close
Set adoRecordset = Nothing
Set adoConnection = Nothing
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 200
Reputation: mnemtsas is an unknown quantity at this point 
Solved Threads: 1
mnemtsas's Avatar
mnemtsas mnemtsas is offline Offline
Junior Poster

Re: Addnew problem

 
0
  #2
Jan 26th, 2005
Please take a look at my ADO Tutorial. This will tell you the correct code to us. I'd say the problem is in your connection string, you may need to add a ';Mode=Read|Write;Persist ' segment to the string.
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 5
Reputation: lostprophet is an unknown quantity at this point 
Solved Threads: 0
lostprophet lostprophet is offline Offline
Newbie Poster

Re: Addnew problem

 
0
  #3
Jan 27th, 2005
hi there,
i have just being doing then ADO objects in college over the past week and from what i have gathered, you seem to be going quite a long way around this. if you use less codes for this and instead just change properties in the properties window in VB while the ADO object is selected, it can be done easier. just try changing the properties of the connection string and record source.
then code a command button i.e. cmdNew with the Recordset.AddNew command. i will be back at college tomorrow and i will be able to post the full code if this helps
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 238
Reputation: uniquestar is an unknown quantity at this point 
Solved Threads: 11
uniquestar's Avatar
uniquestar uniquestar is offline Offline
Daniweb Sponsor

Re: Addnew problem

 
0
  #4
Feb 25th, 2005
Hi, it looks as though in the connection properties that you have selected a read-only connection, hence not being able to update.
try changing that.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC