hello! is anyone out there?

hello! is anyone out there?

Post by Burhan H. Afand » Thu, 29 Jun 2000 04:00:00



Hello everyone

Can someone help me?

What is wrong with the following Visual basic code?

I can read a field in a record but I cant update the field.

Dim db As Connection

  Set db = New Connection

  db.CursorLocation = adUseClient  

  db.Open "PROVIDER=MSDASQL;driver=Microsoft dBase Driver (*.dbf);server=c:\;uid=;pwd=;database=mydatabase"

Dim rs As New Recordset

  Set rs = New Recordset

  rs.Open "select AMOUNT from C:\mydatabase\sales.dbf", db, adOpenStatic,      adLockOptimistic

rs.MoveFirst

Do While Not rs.EOF

rs.Fields(0).Value = rs.Fields(0).Value * 2

rs.Update

rs.MoveNext

Loop

Using the above code; I can read the database but when I try to update a field I get the message:

"Run-time error '-2147467259(8004005)':

[Microsoft][ODBC dBase Driver] Cannot update. Database or object is read-only."

Can someone help me?

So what is wrong why cant I update a field?

Thanks

Burhan H. Afandi

 
 
 

hello! is anyone out there?

Post by reverie_g.. » Fri, 30 Jun 2000 04:00:00


Sounds like youve got your database set as read-only.  Change it to
read/write.

Jennifer



Quote:> This is a multi-part message in MIME format.

> ------=_NextPart_000_0008_01BFE13A.232F04E0
> Content-Type: text/plain;
>    charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

> =20
> Hello everyone

> Can someone help me?

> What is wrong with the following Visual basic code?

> I can read a field in a record but I cant update the field.

> =20

> Dim db As Connection

>   Set db =3D New Connection

>   db.CursorLocation =3D adUseClient =20

>   db.Open "PROVIDER=3DMSDASQL;driver=3DMicrosoft dBase Driver =
> (*.dbf);server=3Dc:\;uid=3D;pwd=3D;database=3Dmydatabase"

> =20

> Dim rs As New Recordset

>   Set rs =3D New Recordset

>   rs.Open "select AMOUNT from C:\mydatabase\sales.dbf", db, =
> adOpenStatic,      adLockOptimistic=20

> rs.MoveFirst

> Do While Not rs.EOF

> rs.Fields(0).Value =3D rs.Fields(0).Value * 2

> rs.Update

> rs.MoveNext

> Loop

> Using the above code; I can read the database but when I try to
update a =
> field I get the message:

> "Run-time error '-2147467259(8004005)':

> [Microsoft][ODBC dBase Driver] Cannot update. Database or object is =
> read-only."

> =20

> Can someone help me?

> So what is wrong why cant I update a field?

> Thanks

> Burhan H. Afandi

> ------=_NextPart_000_0008_01BFE13A.232F04E0
> Content-Type: text/html;
>    charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META content=3D"text/html; charset=3Diso-8859-1" =
> http-equiv=3DContent-Type>
> <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT size=3D2>&nbsp;
> <P class=3DMsoNormal>Hello everyone</P>
> <P class=3DMsoNormal>Can someone help me?</P>
> <P class=3DMsoNormal>What is wrong with the following Visual basic =
> code?</P>
> <P class=3DMsoNormal>I can read a field in a record but I cant update
=
> the=20
> field.</P>
> <P class=3DMsoNormal>&nbsp;<?xml:namespace prefix =3D o ns =3D=20
> "urn:schemas-microsoft-com:office:office" /><o:p></o:p></P>
> <P class=3DMsoNormal>Dim db As Connection<o:p></o:p></P>
> <P class=3DMsoNormal><SPAN style=3D"mso-spacerun: yes">&nbsp;
</SPAN>Set =
> db =3D New=20
> Connection<o:p></o:p></P>
> <P class=3DMsoNormal><SPAN style=3D"mso-spacerun: yes">&nbsp;=20
> </SPAN>db.CursorLocation =3D adUseClient<SPAN style=3D"mso-spacerun: =
> yes">&nbsp;=20
> </SPAN><o:p></o:p></P>
> <P class=3DMsoNormal><SPAN style=3D"mso-spacerun: yes">&nbsp; =
> </SPAN>db.Open=20
> "PROVIDER=3DMSDASQL;driver=3DMicrosoft dBase Driver=20

(*.dbf);server=3Dc:\;uid=3D;pwd=3D;database=3Dmydatabase"<o:p></o:p></P>

- Show quoted text -

Quote:> <P class=3DMsoNormal>&nbsp;<o:p></o:p></P>
> <P class=3DMsoNormal>Dim rs As New Recordset<SPAN=20
> style=3D"mso-spacerun: yes"></SPAN></P>
> <P class=3DMsoNormal><SPAN style=3D"mso-spacerun: yes">&nbsp;
</SPAN>Set =
> rs =3D New=20
> Recordset<o:p></o:p></P>
> <P class=3DMsoNormal><SPAN style=3D"mso-spacerun: yes">&nbsp; =
> </SPAN>rs.Open "select=20
> AMOUNT from C:\mydatabase\sales.dbf", db, adOpenStatic, <SPAN=20
> style=3D"mso-spacerun: =
> yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>adLockOptimistic&nbsp;</P>
> <P class=3DMsoNormal>rs.MoveFirst<o:p></o:p></P>
> <P class=3DMsoNormal>Do While Not rs.EOF<o:p></o:p></P>
> <P class=3DMsoNormal style=3D"TEXT-INDENT: 0.5in">rs.Fields(0).Value
=3D =

> rs.Fields(0).Value * 2<o:p></o:p></P>
> <P class=3DMsoNormal style=3D"TEXT-INDENT: =
> 0.5in">rs.Update<o:p></o:p></P>
> <P class=3DMsoNormal style=3D"TEXT-INDENT: =
> 0.5in">rs.MoveNext<o:p></o:p></P>
> <P class=3DMsoNormal>Loop<o:p></o:p></P>
> <P class=3DMsoNormal>Using the above code; I can read the database
but =
> when I try=20
> to update a field I get the message:</P>
> <P class=3DMsoNormal>&#8220;Run-time error =
> &#8216;-2147467259(8004005)&#8217;:</P>
> <P class=3DMsoNormal>[Microsoft][ODBC dBase Driver] Cannot update. =
> Database or=20
> object is read-only.&#8221;</P>
> <P class=3DMsoNormal>&nbsp;<o:p></o:p></P>
> <P class=3DMsoNormal>Can someone help me?</P>
> <P class=3DMsoNormal>So what is wrong why cant I update a field?</P>
> <P class=3DMsoNormal>Thanks</P>
> <P class=3DMsoNormal>Burhan H. Afandi</P></FONT></DIV></BODY></HTML>

> ------=_NextPart_000_0008_01BFE13A.232F04E0--

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

hello! is anyone out there?

Post by D. David Clar » Fri, 30 Jun 2000 04:00:00


Change adOpenStatic to adOpenDynamic to make your recordset read/write.

    rs.Open "select AMOUNT from C:\mydatabase\sales.dbf", db, adOpenStatic,      adLockOptimistic

 
 
 

1. I am wondering if anyone out there is offering remote DBA support for their customers

I am wondering if anyone out there is offering remote DBA support for their
customers.  We have a system that uses SQL and after we install the system
the database doesn't get maintained.  We were thinking about offering a
service in which we would maintain the database, verify scheduled tasks are
working.  I am not sure what we should consider before doing this.  It
wouldn't be true DBA because there is no deveolping going on to these
databases, we would just maintain them.  What would it take to do this? What
do other people do?

Thanks for your time,
Nora

2. Q: mapi.dll instead of the mapi vbx's that are provided

3. error ORA-01855: AM/A.M. or PM/P.M. required

4. WANTED: Bridge DB-Lib on IPX clients to tcp/ip Sybase servers

5. Busy Day = Slowdown from 12 AM - 5 AM

6. data mask

7. Use of @am, Am I dumb?

8. Calling mailx from within a stored procedure

9. I am getting this message when i am tring to export or import anything using

10. Stored Procedure Initiated Call Outs

11. Performance trouble, time outs

12. Table jumps outs edit mode newby

13. Time outs