|
 |
asptoday_discuss thread: AddNew Method Not Working With OLEDB
Message #1 by howard@c... on Mon, 28 Jan 2002 21:52:22
|
|
I am having a problem with AddNew using OLEDB...I also posted Friday...I
still have *not* figured out so *ANY* help is really appreciated...
I inheirited this code...So...
Here's the problem...The author is using a procedure to open several
recordsets...The recordset defs...
rsOpen ccass, "select * from assessor2001_ccass where parcel_id
= '" & pParcel & "'"
rsOpen ccinv, "select * from residential_ccinv where m_no = " &
pHouseNo & " and m_street = '" & pStreet & "'"
rsOpen ccfha, "select * from residential_ccfha where fha_house
= " & pHouseNo & " and fha_street = '" & pStreet & "'"
rsOpen ccsls, "select * from residential_ccsls where " &
allsales & "s_house = " & pHouseNo & " and s_street = '" &
pStreet & "' order by s_sale_yr desc, s_sale_mo desc,
s_sale_da desc, s_deed desc"
rsOpen ccsub, "select * from residential_ccsub where st_street
= '" & pStreet & "' and st_hi_house >= " & pHouseNo & " and
st_lo_house <= " & pHouseNo
rsOpen tract, "select * from residential_tract where ct_street
= '" & pStreet & "' and ct_hi_house >= " & pHouseNo & " and
ct_lo_house <= " & pHouseNo & " and ct_o_e = '" & pStreetSide
& "'"
rsOpen cczip, "select * from chandler_cczip where zip_street
= '" & pStreet & "' and zip_hi_house >= " & pHouseNo & " and
zip_lo_house <= " & pHouseNo
rsOpen cclot, "select * from webview_lotsales where
lot_subdivision = '" & ccinv("m_subdiv") & "' and lot_number
= '" & ccinv("m_lot") & "' and lot_section = '" & ccinv
("m_section") & "' order by lot_sale_date desc"
rsOpen ccmls, "select * from residential_ccmls where mls_st1 = "
& pHouseNo & " and mls_pis_name = '" & pStreet & "' order by
mls_dte desc"
rsOpen pardat, "select * from assessor2001_pardat where
prdt_parid = '" + pParcel + "'"
rsOpen legdat, "select * from assessor2001_legdat where
lgdt_parid = '" + pParcel + "'"
rsOpen owndat, "select * from assessor2001_owndat where
owdt_parid = '" + pParcel + "'"
rsOpen asmt, "select * from assessor2001_asmt where asmt_parid
= '" + pParcel + "'"
rsOpen land, "select * from assessor2001_land where lnd_parid
= '" + pParcel + "'"
Here's the actual open code which is called above by...
rsOpen Name, sql so pRecordSet becomes name and pSql is passed Select...
sub rsOpen(pRecordset, pSQL)
set pRecordset = server.createobject("adodb.recordset")
pRecordset.Open pSql, cnChandler, 3,3
if pRecordset.eof then
pRecordset.addnew -> Error on this line
end if
end sub
I am getting the following error on pRecordSet.AddNewLine...
ADODB.Recordset error '800a0cb3'
Object or provider is not capable of performing requested operation.
/testwebsite/propinfo/shelby/residential_display_c_2001.asp, line 574
Here's my connection string...
This connection blows up...
Set cnChandler = Server.CreateObject("ADODB.Connection")
cnChandler.Open "Provider=SQLOLEDB.1;Persist Security Info=False;Initial
Catalog=Chandler;Data Source=SqlServer;UID=xx;Pwd=xxx"
This one does not...
Set cnChandler = Server.CreateObject("ADODB.Connection")
cnChandler.Open "DSN=ChandlerSQL;DATABASE=Chandler", "xx", "xxx"
This is one of those times that it's really difficult to tell why exactly
he was using the AddNew...Because...There's not any Update for the
recordset...So...He's just adding a blank rec to recordset...He later uses
the RecordCount to check for records...
If I had my choice (and time to)...I would rewrite...However, I just need
the quick/dirty fix...
Thanks in advance...
KLC
Message #2 by "Dmitry Zakharov" <brook74@h...> on Tue, 29 Jan 2002 09:52:11
|
|
I think the reason is query recordsets are not upddatable....
Check 'AllowAddNew' property or send me a code. Multy table recordset
doesn allow Add or Edit records to/in itself. I would recommend ya to use
stored procedures insted of invocation of methods... It will also allow ya
to customize addition in the futher....
cheers
> I am having a problem with AddNew using OLEDB...I also posted Friday...I
> still have *not* figured out so *ANY* help is really appreciated...
>
> I inheirited this code...So...
>
> Here's the problem...The author is using a procedure to open several
> recordsets...The recordset defs...
>
> rsOpen ccass, "select * from assessor2001_ccass where parcel_id
> = '" & pParcel & "'"
>
> rsOpen ccinv, "select * from residential_ccinv where m_no = " &
> pHouseNo & " and m_street = '" & pStreet & "'"
>
> rsOpen ccfha, "select * from residential_ccfha where fha_house
> = " & pHouseNo & " and fha_street = '" & pStreet & "'"
>
> rsOpen ccsls, "select * from residential_ccsls where " &
> allsales & "s_house = " & pHouseNo & " and s_street = '" &
> pStreet & "' order by s_sale_yr desc, s_sale_mo desc,
> s_sale_da desc, s_deed desc"
>
> rsOpen ccsub, "select * from residential_ccsub where st_street
> = '" & pStreet & "' and st_hi_house >= " & pHouseNo & " and
> st_lo_house <= " & pHouseNo
>
> rsOpen tract, "select * from residential_tract where ct_street
> = '" & pStreet & "' and ct_hi_house >= " & pHouseNo & " and
> ct_lo_house <= " & pHouseNo & " and ct_o_e = '" & pStreetSide
> & "'"
>
> rsOpen cczip, "select * from chandler_cczip where zip_street
> = '" & pStreet & "' and zip_hi_house >= " & pHouseNo & " and
> zip_lo_house <= " & pHouseNo
>
> rsOpen cclot, "select * from webview_lotsales where
> lot_subdivision = '" & ccinv("m_subdiv") & "' and lot_number
> = '" & ccinv("m_lot") & "' and lot_section = '" & ccinv
> ("m_section") & "' order by lot_sale_date desc"
>
> rsOpen ccmls, "select * from residential_ccmls where mls_st1 = "
> & pHouseNo & " and mls_pis_name = '" & pStreet & "' order by
> mls_dte desc"
>
> rsOpen pardat, "select * from assessor2001_pardat where
> prdt_parid = '" + pParcel + "'"
>
> rsOpen legdat, "select * from assessor2001_legdat where
> lgdt_parid = '" + pParcel + "'"
>
> rsOpen owndat, "select * from assessor2001_owndat where
> owdt_parid = '" + pParcel + "'"
>
> rsOpen asmt, "select * from assessor2001_asmt where asmt_parid
> = '" + pParcel + "'"
>
> rsOpen land, "select * from assessor2001_land where lnd_parid
> = '" + pParcel + "'"
>
> Here's the actual open code which is called above by...
>
> rsOpen Name, sql so pRecordSet becomes name and pSql is passed Select...
>
> sub rsOpen(pRecordset, pSQL)
> set pRecordset = server.createobject("adodb.recordset")
>
> pRecordset.Open pSql, cnChandler, 3,3
>
> if pRecordset.eof then
>
> pRecordset.addnew -> Error on this line
>
> end if
>
> end sub
>
> I am getting the following error on pRecordSet.AddNewLine...
>
> ADODB.Recordset error '800a0cb3'
>
> Object or provider is not capable of performing requested operation.
>
> /testwebsite/propinfo/shelby/residential_display_c_2001.asp, line 574
>
> Here's my connection string...
>
> This connection blows up...
>
> Set cnChandler = Server.CreateObject("ADODB.Connection")
> cnChandler.Open "Provider=SQLOLEDB.1;Persist Security Info=False;Initial
> Catalog=Chandler;Data Source=SqlServer;UID=xx;Pwd=xxx"
>
> This one does not...
>
> Set cnChandler = Server.CreateObject("ADODB.Connection")
> cnChandler.Open "DSN=ChandlerSQL;DATABASE=Chandler", "xx", "xxx"
>
> This is one of those times that it's really difficult to tell why
exactly
> he was using the AddNew...Because...There's not any Update for the
> recordset...So...He's just adding a blank rec to recordset...He later
uses
> the RecordCount to check for records...
>
> If I had my choice (and time to)...I would rewrite...However, I just
need
> the quick/dirty fix...
>
> Thanks in advance...
>
> KLC
Message #3 by howard@c... on Tue, 29 Jan 2002 15:25:12
|
|
> I think the reason is query recordsets are not upddatable....
That's why I'm using 3,3 on open so will be updatable...
> Check 'AllowAddNew' property or send me a code.
How to do...???
> Multy table recordset doesn allow Add or Edit records to/in itself. I
would recommend ya to use stored procedures insted of invocation of
methods... It will also allow ya to customize addition in the futher....
I realize stored proc is way to go...I don't have time to re-write...
Any ideas...???
Message #4 by "Dmitry Brook" <brook74@h...> on Tue, 29 Jan 2002 15:31:42 +0000
|
|
Try to play with Recorset settings...
>From: howard@c...
>Reply-To: "ASPToday Discuss" <asptoday_discuss@p...>
>To: "ASPToday Discuss" <asptoday_discuss@p...>
>Subject: [asptoday_discuss] Re: AddNew Method Not Working With OLEDB
>Date: Tue, 29 Jan 2002 15:25:12
>
> > I think the reason is query recordsets are not upddatable....
>
>That's why I'm using 3,3 on open so will be updatable...
>
> > Check 'AllowAddNew' property or send me a code.
>
>How to do...???
>
> > Multy table recordset doesn allow Add or Edit records to/in itself. I
>would recommend ya to use stored procedures insted of invocation of
>methods... It will also allow ya to customize addition in the futher....
>
>I realize stored proc is way to go...I don't have time to re-write...
>
>Any ideas...???
>
>
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
|
|
 |