Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SQL Insert vs Recordset Addnew


Message #1 by Liming Xu <lmxu@w...> on Tue, 13 Feb 2001 12:07:54 -0500
Hello, here is a weired problem...



when I  use SQL "Insert" Command ,



sConnStr="Provider=SQLOLEDB; Data Source=123.12.2.132; Database=Movie; User ID=sa;

Password="

 Set objComm=Server.CreateObject("ADODB.Command")

 objComm.ActiveConnection=sConnStr

 objComm.CommandText = "Insert INTO Movie(mindex) values ('" & mindex & "')"

 objComm.CommandType=adCmdText

 objComm.Execute intNoOfRecords



This way works fine.... But the same way if I use Recordset AddNew method,



 sConnStr="Provider=SQLOLEDB; Data Source=123.12.2.132; Database=Movie; User ID=sa;

Password="

 Set objRec=Server.CreateObject("ADODB.Recordset")

 objRec.Open "Movie",sConnStr,adOpenStatic,adLockOptimistic,adCmdTable

objRec.AddNew

objRec("mindex")=mindex

objRec.Update  (21)



The server says " Line (21), do not leave values blank".... so that means my database is

corrrect, it's a matter of my syntax

in the second case...... see anything I did wrong with AddNew... I checked

spelling.....it's not a problem...thanks...







Message #2 by "Wally Burfine" <oopconsultant@h...> on Tue, 13 Feb 2001 19:10:15 -0000
a static cursor provides a non-updatable copy of the recordset.

Use keyset cursor adOpenKeyset





>From: Liming Xu <lmxu@w...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] SQL Insert vs Recordset Addnew

>Date: Tue, 13 Feb 2001 12:07:54 -0500

>

>Hello, here is a weired problem...

>

>when I  use SQL "Insert" Command ,

>

>sConnStr="Provider=SQLOLEDB; Data Source=123.12.2.132; Database=Movie; User 

>ID=sa;

>Password="

>  Set objComm=Server.CreateObject("ADODB.Command")

>  objComm.ActiveConnection=sConnStr

>  objComm.CommandText = "Insert INTO Movie(mindex) values ('" & mindex & 

>"')"

>  objComm.CommandType=adCmdText

>  objComm.Execute intNoOfRecords

>

>This way works fine.... But the same way if I use Recordset AddNew method,

>

>  sConnStr="Provider=SQLOLEDB; Data Source=123.12.2.132; Database=Movie; 

>User ID=sa;

>Password="

>  Set objRec=Server.CreateObject("ADODB.Recordset")

>  objRec.Open "Movie",sConnStr,adOpenStatic,adLockOptimistic,adCmdTable

>objRec.AddNew

>objRec("mindex")=mindex

>objRec.Update  (21)

>

>The server says " Line (21), do not leave values blank".... so that means 

>my database is

>corrrect, it's a matter of my syntax

>in the second case...... see anything I did wrong with AddNew... I checked

>spelling.....it's not a problem...thanks...

>

>

>
Message #3 by "Ken Schaefer" <ken@a...> on Wed, 14 Feb 2001 09:36:03 +1100

----- Original Message -----

From: "Wally Burfine" <oopconsultant@h...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, February 14, 2001 6:10 AM

Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew





> a static cursor provides a non-updatable copy of the recordset.

> Use keyset cursor adOpenKeyset





Where did you get this information from? I thought the *lock type*

determined whether you could update a recordset or not, not the cursor

type...



Cheers

Ken



Message #4 by "Wally Burfine" <oopconsultant@h...> on Wed, 14 Feb 2001 04:48:18 -0000
Ken,



I actually got it out of a book at work, one of the wrox asp books. So I 

can't verify it right now. However, on page 772 of SQL Server 7 Developer's 

Guide (OTEY & CONTE - Osborne/McGraw Hill 1999) it states that "ADO 

Recordset objects that use static cursors are not updateable, ..."



The lock type of adLockReadOnly restricts the updateability, the others only 

determine when the lock is set for the update. The reason that the 

adLockReadOnly makes the rs non-updateable is that the lock can not be set 

to do an update.



Regards,

Wally





>From: "Ken Schaefer" <ken@a...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew

>Date: Wed, 14 Feb 2001 09:36:03 +1100

>

>

>----- Original Message -----

>From: "Wally Burfine" <oopconsultant@h...>

>To: "ASP Databases" <asp_databases@p...>

>Sent: Wednesday, February 14, 2001 6:10 AM

>Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew

>

>

> > a static cursor provides a non-updatable copy of the recordset.

> > Use keyset cursor adOpenKeyset

>

>

>Where did you get this information from? I thought the *lock type*

>determined whether you could update a recordset or not, not the cursor

>type...

>

>Cheers

>Ken

>

>
Message #5 by Liming Xu <lmxu@w...> on Wed, 14 Feb 2001 14:38:32 -0500 (EST)
Ken and Wally, 



what I did was   





	Set objRec = Server.CreateObject("ADODB.RecordSetobjRec.Open "Movie",

	objRec.open "movie", strConnect,adOpenStatic,adLockOptimistic,adCmdTable

	objRec.AddNew

		objRec("mindex")=mindex

	objRec.Update

	objRec.close

	Set objRec=Nothing



adOpenStatic works...but only if I switch to another table other than

"movie". I have another table called "category" and I'm able to insert

stuff into it using adOpenStatic.  "movie" is the only table that doens't

work with objRec.ADDNew. The same table "movie" works if I use SQL

insert, that is, "insert into movie(mindex) values ('mindex')". I also

tried to use adOpenKeySet, and the same thing happens... so I'm not too

sure what's the deal here using SQL insert vs Recordset Addnew....



I checked the table "movie" and "category", their strcutre is almost the

same, both "mindex" are primary key and no default value..







On Wed, 14 CFeb 2001, Wally Burfine wrote:



> Ken,

> 

> I actually got it out of a book at work, one of the wrox asp books. So I 

> can't verify it right now. However, on page 772 of SQL Server 7 Developer's 

> Guide (OTEY & CONTE - Osborne/McGraw Hill 1999) it states that "ADO 

> Recordset objects that use static cursors are not updateable, ..."

> 

> The lock type of adLockReadOnly restricts the updateability, the others only 

> determine when the lock is set for the update. The reason that the 

> adLockReadOnly makes the rs non-updateable is that the lock can not be set 

> to do an update.

> 

> Regards,

> Wally

> 

> 

> >From: "Ken Schaefer" <ken@a...>

> >Reply-To: "ASP Databases" <asp_databases@p...>

> >To: "ASP Databases" <asp_databases@p...>

> >Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew

> >Date: Wed, 14 Feb 2001 09:36:03 +1100

> >

> >

> >----- Original Message -----

> >From: "Wally Burfine" <oopconsultant@h...>

> >To: "ASP Databases" <asp_databases@p...>

> >Sent: Wednesday, February 14, 2001 6:10 AM

> >Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew

> >

> >

> > > a static cursor provides a non-updatable copy of the recordset.

> > > Use keyset cursor adOpenKeyset

> >

> >

> >Where did you get this information from? I thought the *lock type*

> >determined whether you could update a recordset or not, not the cursor

> >type...

> >

> >Cheers

> >Ken

> >

> 



Message #6 by "Ken Schaefer" <ken@a...> on Thu, 15 Feb 2001 10:56:14 +1100
> Ken,

>

> I actually got it out of a book at work, one of the wrox asp books. So I

> can't verify it right now. However, on page 772 of SQL Server 7

Developer's

> Guide (OTEY & CONTE - Osborne/McGraw Hill 1999) it states that "ADO

> Recordset objects that use static cursors are not updateable, ..."



You're right - but attempting to open an adOpenStatic cursor with an

updateable locktype gives you an adOpenKeyset cursor instead...



<results>

Attempted to open Recordset with cursortype: adOpenForwardOnly

Recordset opened with cursor-type: adOpenForwardOnly.

Recordset supports .AddNew



Attempted to open Recordset with cursortype: adOpenStatic

Recordset opened with cursor-type: adOpenKeyset.

Recordset supports .AddNew



Attempted to open Recordset with cursortype: adOpenKeyset

Recordset opened with cursor-type: adOpenKeyset.

Recordset supports .AddNew



Attempted to open Recordset with cursortype: adOpenDynamic

Recordset opened with cursor-type: adOpenDynamic.

Recordset supports .AddNew

</results>



<code>

<%

Option Explicit

Response.Buffer = True



' - - - - - - - - - - - - - - - - - -

' Developed 2001 Ken Schaefer

' ken@a...

'

' Test for updatability of recordsets by cursor type

' - - - - - - - - - - - - - - - - - -



Call Main()



Sub Main( _

 )



 On Error Resume Next



 Call subOpenConn(Application("CareersSQLServer_ConnectionString"))



 If err.Number <> 0 then

  Call subWriteError(err.Number, "Main", err.Description)

 End if



End Sub ' Sub Main



' - - - - - - - - - - - - - - - - - -



Sub subWriteError( _

 byVal strErrorNumber, _

 byVal strErrorSource, _

 byVal strErrorDescription _

 )



 Response.Clear



 Response.Write("<b>An Error Has Occurred. The details are:</b><br>" &

vbCrLf)

 Response.Write("Error Number: " & strErrorNumber & "<br>" & vbCrLf)

 Response.Write("Error Source: " & strErrorSource & "<br>" & vbCrLf)

 Response.Write("Error Description: " & strErrorDescription & "<br>" &

vbCrLf)



 Response.Flush

 Response.End



End Sub ' subWriteError



' - - - - - - - - - - - - - - - - - -



Sub subADOClose( _

 byRef objToClose _

 )



 If objToClose.State = adStateOpen then

  objToClose.close

 End if



 If isObject(objToClose) then

  Set objToClose = nothing

 End if



End Sub ' subADOClose





' - - - - - - - - - - - - - - - - - -



Sub subOpenConn( _

 byVal strDBConnectionString _

 )



 Dim objConn    ' As ADODB.Connection



 On Error Resume Next



 Set objConn = Server.CreateObject("ADODB.Connection")

 objConn.Open strDBConnectionString



 Call subTestCursors("Zones", objConn, adOpenForwardOnly, adLockOptimistic,

adCmdTableDirect)

 Call subTestCursors("Zones", objConn, adOpenStatic, adLockOptimistic,

adCmdTableDirect)

 Call subTestCursors("Zones", objConn, adOpenKeyset, adLockOptimistic,

adCmdTableDirect)

 Call subTestCursors("Zones", objConn, adOpenDynamic, adLockOptimistic,

adCmdTableDirect)



 If err.Number <> 0 then

  Call subWriteError(err.Number, "subOpenConn", err.Description)

 End if



 Call subADOClose(objConn)



End Sub ' subOpenConn



' - - - - - - - - - - - - - - - - - -



Sub subTestCursors( _

 byVal strSource, _

 byRef objConnection, _

 byVal strCursorType, _

 byVal strLockType, _

 byVal strOptions _

 )



 Dim objRS   ' As ADODB.Recordset



 On Error Resume Next



 Set objRS = Server.CreateObject("ADODB.Recordset")

 objRS.Open strSource, objConnection, strCursorType, strLockType, strOptions



 Response.Write("Attempted to open Recordset with cursortype: " &

fncGetCursorType(strCursorType) & "<br>" & vbCrLf)

 Response.Write("Recordset opened with cursor-type: " &

fncGetCursorType(objRS.CursorType) & ".<br>" & vbCrLf)



 If objRS.Supports(adAddNew) then

  Response.Write("Recordset supports .AddNew<br><br>" & vbCrLf)

 Else

  Response.Write("Recordset does not support .AddNew<br><br>" & vbCrLf)

 End if



 If err.Number <> 0 then

  Call subWriteError(err.Number, "subTestCursors", err.Description)

 End if



 Call subADOClose(objRS)



End Sub ' subTestCursors



' - - - - - - - - - - - - - - - - - -



Function fncGetCursorType( _

 byVal intCursorType _

 )



 Select Case intCursorType

 Case 0

  fncGetCursorType = "adOpenForwardOnly"

 Case 1

  fncGetCursorType = "adOpenKeyset"

 Case 2

  fncGetCursorType = "adOpenDynamic"

 Case 3

  fncGetCursorType = "adOpenStatic"

 Case -1

  fncGetCursorType = "unknown"

 Case Else

  fncGetCursorType = "something has gone very wrong!"

 End Select



End Function ' fncGetCursorType



%>

</code>



Message #7 by "Ken Schaefer" <ken@a...> on Thu, 15 Feb 2001 10:57:57 +1100
User permissions with the DB perhaps? Maybe the user you are connecting as

has only Data Reader permissions, and not Data Writer permissions?



Cheers

Ken



----- Original Message -----

From: "Liming Xu" <lmxu@w...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, February 15, 2001 6:38 AM

Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew





> Ken and Wally,

>

> what I did was

>

>

> Set objRec = Server.CreateObject("ADODB.RecordSetobjRec.Open "Movie",

> objRec.open "movie", strConnect,adOpenStatic,adLockOptimistic,adCmdTable

> objRec.AddNew

> objRec("mindex")=mindex

> objRec.Update

> objRec.close

> Set objRec=Nothing





Message #8 by "Wally Burfine" <oopconsultant@h...> on Thu, 15 Feb 2001 14:48:13 -0000
I guess you need to look at the table definition and the value of mindex. 

Post those and let us take a look.



>From: Liming Xu <lmxu@w...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew

>Date: Wed, 14 Feb 2001 14:38:32 -0500 (EST)

>

>Ken and Wally,

>

>what I did was

>

>

>	Set objRec = Server.CreateObject("ADODB.RecordSetobjRec.Open "Movie",

>	objRec.open "movie", strConnect,adOpenStatic,adLockOptimistic,adCmdTable

>	objRec.AddNew

>		objRec("mindex")=mindex

>	objRec.Update

>	objRec.close

>	Set objRec=Nothing

>

>adOpenStatic works...but only if I switch to another table other than

>"movie". I have another table called "category" and I'm able to insert

>stuff into it using adOpenStatic.  "movie" is the only table that doens't

>work with objRec.ADDNew. The same table "movie" works if I use SQL

>insert, that is, "insert into movie(mindex) values ('mindex')". I also

>tried to use adOpenKeySet, and the same thing happens... so I'm not too

>sure what's the deal here using SQL insert vs Recordset Addnew....

>

>I checked the table "movie" and "category", their strcutre is almost the

>same, both "mindex" are primary key and no default value..

>

>

>

>On Wed, 14 CFeb 2001, Wally Burfine wrote:

>

> > Ken,

> >

> > I actually got it out of a book at work, one of the wrox asp books. So I

> > can't verify it right now. However, on page 772 of SQL Server 7 

>Developer's

> > Guide (OTEY & CONTE - Osborne/McGraw Hill 1999) it states that "ADO

> > Recordset objects that use static cursors are not updateable, ..."

> >

> > The lock type of adLockReadOnly restricts the updateability, the others 

>only

> > determine when the lock is set for the update. The reason that the

> > adLockReadOnly makes the rs non-updateable is that the lock can not be 

>set

> > to do an update.

> >

> > Regards,

> > Wally

> >

> >

> > >From: "Ken Schaefer" <ken@a...>

> > >Reply-To: "ASP Databases" <asp_databases@p...>

> > >To: "ASP Databases" <asp_databases@p...>

> > >Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew

> > >Date: Wed, 14 Feb 2001 09:36:03 +1100

> > >

> > >

> > >----- Original Message -----

> > >From: "Wally Burfine" <oopconsultant@h...>

> > >To: "ASP Databases" <asp_databases@p...>

> > >Sent: Wednesday, February 14, 2001 6:10 AM

> > >Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew

> > >

> > >

> > > > a static cursor provides a non-updatable copy of the recordset.

> > > > Use keyset cursor adOpenKeyset

> > >

> > >

> > >Where did you get this information from? I thought the *lock type*

> > >determined whether you could update a recordset or not, not the cursor

> > >type...

> > >

> > >Cheers

> > >Ken

> > >

> >

>

>
Message #9 by "Bo Guan" <guan_bo@h...> on Thu, 15 Feb 2001 19:44:59
Hi Ken, 



Nice code.  One more thing need to be mentioned is that the resulted 

cursor type depends on the type of data provider.  For example, if we ask 

for Optimistic lock and static cursor type, SQLOLEDB will return a keyset 

cursor, while ODBC connection will return a static cursor as requested.  



I actually learned about this from a WROX book (ADO/RDS), but according to 

that book, SQLOLEDB always returns Dynamic cursor even when you ask for 

Keyset or Static if the locktype is other than readonly.  



I tried your script and got the same result as yours. So I guess the book 

must be wrong.  I also tried with Jet(Access) connection -- this time the 

book is correct, Jet engine returns Keyset cursor whenever you want a 

lockttype other than readonly.  Haven't tried the ODBCSQL yet.



> > Ken,

> >

> > I actually got it out of a book at work, one of the wrox asp books. So 

I

> > can't verify it right now. However, on page 772 of SQL Server 7

> Developer's

> > Guide (OTEY & CONTE - Osborne/McGraw Hill 1999) it states that "ADO

> > Recordset objects that use static cursors are not updateable, ..."

> 

> You're right - but attempting to open an adOpenStatic cursor with an

> updateable locktype gives you an adOpenKeyset cursor instead...

> 

> <results>

> Attempted to open Recordset with cursortype: adOpenForwardOnly

> Recordset opened with cursor-type: adOpenForwardOnly.

> Recordset supports .AddNew

> 

> Attempted to open Recordset with cursortype: adOpenStatic

> Recordset opened with cursor-type: adOpenKeyset.

> Recordset supports .AddNew

> 

> Attempted to open Recordset with cursortype: adOpenKeyset

> Recordset opened with cursor-type: adOpenKeyset.

> Recordset supports .AddNew

> 

> Attempted to open Recordset with cursortype: adOpenDynamic

> Recordset opened with cursor-type: adOpenDynamic.

> Recordset supports .AddNew

> </results>

> 

> <code>

> <%

> Option Explicit

> Response.Buffer = True

> 

> ' - - - - - - - - - - - - - - - - - -

> ' Developed 2001 Ken Schaefer

> ' ken@a...

> '

> ' Test for updatability of recordsets by cursor type

> ' - - - - - - - - - - - - - - - - - -

> 

> Call Main()

> 

> Sub Main( _

>  )

> 

>  On Error Resume Next

> 

>  Call subOpenConn(Application("CareersSQLServer_ConnectionString"))

> 

>  If err.Number <> 0 then

>   Call subWriteError(err.Number, "Main", err.Description)

>  End if

> 

> End Sub ' Sub Main

> 

> ' - - - - - - - - - - - - - - - - - -

> 

> Sub subWriteError( _

>  byVal strErrorNumber, _

>  byVal strErrorSource, _

>  byVal strErrorDescription _

>  )

> 

>  Response.Clear

> 

>  Response.Write("<b>An Error Has Occurred. The details are:</b><br>" &

> vbCrLf)

>  Response.Write("Error Number: " & strErrorNumber & "<br>" & vbCrLf)

>  Response.Write("Error Source: " & strErrorSource & "<br>" & vbCrLf)

>  Response.Write("Error Description: " & strErrorDescription & "<br>" &

> vbCrLf)

> 

>  Response.Flush

>  Response.End

> 

> End Sub ' subWriteError

> 

> ' - - - - - - - - - - - - - - - - - -

> 

> Sub subADOClose( _

>  byRef objToClose _

>  )

> 

>  If objToClose.State = adStateOpen then

>   objToClose.close

>  End if

> 

>  If isObject(objToClose) then

>   Set objToClose = nothing

>  End if

> 

> End Sub ' subADOClose

> 

> 

> ' - - - - - - - - - - - - - - - - - -

> 

> Sub subOpenConn( _

>  byVal strDBConnectionString _

>  )

> 

>  Dim objConn    ' As ADODB.Connection

> 

>  On Error Resume Next

> 

>  Set objConn = Server.CreateObject("ADODB.Connection")

>  objConn.Open strDBConnectionString

> 

>  Call subTestCursors("Zones", objConn, adOpenForwardOnly, 

adLockOptimistic,

> adCmdTableDirect)

>  Call subTestCursors("Zones", objConn, adOpenStatic, adLockOptimistic,

> adCmdTableDirect)

>  Call subTestCursors("Zones", objConn, adOpenKeyset, adLockOptimistic,

> adCmdTableDirect)

>  Call subTestCursors("Zones", objConn, adOpenDynamic, adLockOptimistic,

> adCmdTableDirect)

> 

>  If err.Number <> 0 then

>   Call subWriteError(err.Number, "subOpenConn", err.Description)

>  End if

> 

>  Call subADOClose(objConn)

> 

> End Sub ' subOpenConn

> 

> ' - - - - - - - - - - - - - - - - - -

> 

> Sub subTestCursors( _

>  byVal strSource, _

>  byRef objConnection, _

>  byVal strCursorType, _

>  byVal strLockType, _

>  byVal strOptions _

>  )

> 

>  Dim objRS   ' As ADODB.Recordset

> 

>  On Error Resume Next

> 

>  Set objRS = Server.CreateObject("ADODB.Recordset")

>  objRS.Open strSource, objConnection, strCursorType, strLockType, 

strOptions

> 

>  Response.Write("Attempted to open Recordset with cursortype: " &

> fncGetCursorType(strCursorType) & "<br>" & vbCrLf)

>  Response.Write("Recordset opened with cursor-type: " &

> fncGetCursorType(objRS.CursorType) & ".<br>" & vbCrLf)

> 

>  If objRS.Supports(adAddNew) then

>   Response.Write("Recordset supports .AddNew<br><br>" & vbCrLf)

>  Else

>   Response.Write("Recordset does not support .AddNew<br><br>" & vbCrLf)

>  End if

> 

>  If err.Number <> 0 then

>   Call subWriteError(err.Number, "subTestCursors", err.Description)

>  End if

> 

>  Call subADOClose(objRS)

> 

> End Sub ' subTestCursors

> 

> ' - - - - - - - - - - - - - - - - - -

> 

> Function fncGetCursorType( _

>  byVal intCursorType _

>  )

> 

>  Select Case intCursorType

>  Case 0

>   fncGetCursorType = "adOpenForwardOnly"

>  Case 1

>   fncGetCursorType = "adOpenKeyset"

>  Case 2

>   fncGetCursorType = "adOpenDynamic"

>  Case 3

>   fncGetCursorType = "adOpenStatic"

>  Case -1

>   fncGetCursorType = "unknown"

>  Case Else

>   fncGetCursorType = "something has gone very wrong!"

>  End Select

> 

> End Function ' fncGetCursorType

> 

> %>

> </code>

> 

Message #10 by Liming Xu <lmxu@w...> on Thu, 15 Feb 2001 17:36:33 -0500
thanks for all your helps......



hm...if AddNew has no permission to the DB, then why the SQL statement "insert

into movies(mindex) values(mindex)" works? Should both statements access the

database with the same kind of permissions?



anyway, I'm just curious that's all...currently, I'll just use SQL "insert"

statement...



Thanks for all your helps..



Ken Schaefer wrote:



> User permissions with the DB perhaps? Maybe the user you are connecting as

> has only Data Reader permissions, and not Data Writer permissions?

>

> Cheers

> Ken

>

> ----- Original Message -----

> From: "Liming Xu" <lmxu@w...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Thursday, February 15, 2001 6:38 AM

> Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew

>

> > Ken and Wally,

> >

> > what I did was

> >

> >

> > Set objRec = Server.CreateObject("ADODB.RecordSetobjRec.Open "Movie",

> > objRec.open "movie", strConnect,adOpenStatic,adLockOptimistic,adCmdTable

> > objRec.AddNew

> > objRec("mindex")=mindex

> > objRec.Update

> > objRec.close

> > Set objRec=Nothing

>
Message #11 by "Ken Schaefer" <ken@a...> on Fri, 16 Feb 2001 10:03:34 +1100
If the SQL Insert statement works, but .addNew doesn't then it can't use a

user permissions problem...sorry, my mistake.



Cheers

Ken



----- Original Message -----

From: "Liming Xu" <lmxu@w...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, February 16, 2001 9:36 AM

Subject: [asp_databases] Re: SQL Insert vs Recordset Addnew





> thanks for all your helps......

>

> hm...if AddNew has no permission to the DB, then why the SQL statement

"insert

> into movies(mindex) values(mindex)" works? Should both statements access

the

> database with the same kind of permissions?

>

> anyway, I'm just curious that's all...currently, I'll just use SQL

"insert"

> statement...

>

> Thanks for all your helps..

>

> Ken Schaefer wrote:

>

> > User permissions with the DB perhaps? Maybe the user you are connecting

as

> > has only Data Reader permissions, and not Data Writer permissions?

> >

> > Cheers

> > Ken






  Return to Index