Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Friday, March 30, 2012

ID Creation/ASP/SQL Server

Using SQL Server with ASP for an intranet website.
I'm generating a ID using a user defined function. (getting the Maximum and
adding 1 to get a new ID )
During testing i have got 2 similar ids (example: 31000,31000) for 2 records
when there is concurrent access to a website
here i need to track the ID generated,manipulate and convert into string
format (example: U31000_CTF_FILE)
so im generating it thru function.
is there any other best way to generate & track IDs.
Note: im not using any stored procedures moreover i want to use normal ASP
code only
please help
-dnkHi
You can try somethimg like that
CREATE PROC spNewIds
AS
DECLARE @.new_id INT
BEGIN TRANSACTION
SELECT @.new_id =COALESCE(MAX(Id)+1,0) FROM MyTable WITH (UPDLOCK,HOLDLOCK)
INSERT INTO AnotherTable (colname) VALUES (@.new_id )
COMMIT TRANSACTION
"DNKMCA" <dnk@.msn.com> wrote in message
news:uPeCLiOFGHA.916@.TK2MSFTNGP10.phx.gbl...
> Using SQL Server with ASP for an intranet website.
> I'm generating a ID using a user defined function. (getting the Maximum
> and
> adding 1 to get a new ID )
> During testing i have got 2 similar ids (example: 31000,31000) for 2
> records
> when there is concurrent access to a website
> here i need to track the ID generated,manipulate and convert into string
> format (example: U31000_CTF_FILE)
> so im generating it thru function.
> is there any other best way to generate & track IDs.
> Note: im not using any stored procedures moreover i want to use normal
> ASP
> code only
> please help
> -dnk
>|||Why don't you just have a dummy table with an IDENTITY column?
CREATE TABLE dbo.MyTable(ID INT IDENTITY(1,1))
Now In the ASP code,
set rs = conn.execute("SET NOCOUNT ON; INSERT dbo.MyTable DEFAULT VALUES;
SELECT SCOPE_IDENTITY()")
Response.Write rs(0)
Though I'm not sure I understand the objection to using stored procedures,
or what you mean by "track IDs"...
"DNKMCA" <dnk@.msn.com> wrote in message
news:uPeCLiOFGHA.916@.TK2MSFTNGP10.phx.gbl...
> Using SQL Server with ASP for an intranet website.
> I'm generating a ID using a user defined function. (getting the Maximum
> and
> adding 1 to get a new ID )
> During testing i have got 2 similar ids (example: 31000,31000) for 2
> records
> when there is concurrent access to a website
> here i need to track the ID generated,manipulate and convert into string
> format (example: U31000_CTF_FILE)
> so im generating it thru function.
> is there any other best way to generate & track IDs.
> Note: im not using any stored procedures moreover i want to use normal
> ASP
> code only
> please help
> -dnk
>sql

IAuthorizationExtension and RoleProvider

We have developed a custom asp.net 2.0 RoleProvider to Authorize access to
different areas of our web app so that administrators of our application
could control access rather than IT staff. The custom RoleProvider reads
user and role information from a SQLServer 2005 Database. We are not using a
custom MembershipProvider. We are now trying to integrate Reporting Services
2005 with the Web App. I want the Roles used to authorize access to reports
be the same roles that are used to authorize access to the pages in my web
app. I would like to have reporting services use my custom RoleProvider. It
is my understanding that I need to create a class that implements
IAuthorizationExtension to do this.
I have the example from the Teo Lachev book. Not exacly what i needed, but
of figre if I could get that one running, I could modify it to call my custom
RoleProvider. When I implemented the sample from the book, I get an
exceiption when it calls the BinaryFormatter Deserialize method to
deserialize SecDesc item that was passed to GetAccess. The error message i
get is 'The input stream is not in a valid binary format. The starting
contents (in bytes) are :06-05-00-9c...'
Can anyone how a custom Authorization Extension is supposed to use the
Security descriptors it gets from RS?
Has anyone managed to use asp.net 2.0 RoleProviders with RS2005? Is there
any good documentation on how to implement and deploy an
IAuthorizationExtension? Should I be taking another approach?
It Seems to me that there ought to be [supplied by microsoft] an
implementation of the IAuthorizationExtension that calls a RoleProvider to
determine what groups a user is in, but I have not been able to find it.
Without this ability, the RoleProvider functionality is useless, because IT
staff would need to maintain AD Groups to control access to reports while an
Application Administrator would need to maintain RoleProvider Groups that
control access to my pages. It sounds like if someone wants to use
Reporting services, the should not be using a custom RoleProvider.Just in case anyone else experiences this problem in the future , I thought
I'd document what I've figured out so far. This is probably all buried in
some documentation somewhere, but I've been unable to find it.
When writing my pervious post, I had installed RS2005 and then installed a
custom Authorization Extension and was getting an error saying 'The
input stream is not in a valid binary format...'. when trying to access the
root folder of the report server. I had copied much of the code from the
Lachev book.
The root folder of the report server was created at the time I installed
RS2005. My custom Authorization Extension was not in place at the time the
root folder was created , so the ACL for the folder was created serialized
using the CreateSecurityDescriptor method of the default Authorization
Extension that comes with RS2005 (i.e. the one that works with AD groups).
I could browse to the root folder of the report server at this time with no
problem.
After I installed my custom Authorization Extension and browsed to the root
folder, RS Passed the ACL created and serialized by the default
Authorization Extension to my custom Authorization Extension. This caused
the issue. The CreateSecurityDescriptor and the CheckAccess methods work
hand-in-hand. The ACL create by CreateSecurityDescriptor of the default
Authorization Extension could not be deserialized by the GetAccess method of
my Custom Authorization Extension.
Afterwards, I created a new folder. Because this new folder was created
with my extension in place, the ACL was serialized by my own
CreateSecurityDescriptor method, and thus could be deserialized by my own
GetAccess method with no problem.
I just can't access the root folder after having installedmy extension,
because the security extension was not created by my code!.
"gover" <gover@.discussions.microsoft.com> wrote in message
news:03E811C4-6811-45EB-A071-0CAF14771C28@.microsoft.com...
> We have developed a custom asp.net 2.0 RoleProvider to Authorize access
> to
> different areas of our web app so that administrators of our application
> could control access rather than IT staff. The custom RoleProvider reads
> user and role information from a SQLServer 2005 Database. We are not using
> a
> custom MembershipProvider. We are now trying to integrate Reporting
> Services
> 2005 with the Web App. I want the Roles used to authorize access to
> reports
> be the same roles that are used to authorize access to the pages in my web
> app. I would like to have reporting services use my custom RoleProvider.
> It
> is my understanding that I need to create a class that implements
> IAuthorizationExtension to do this.
> I have the example from the Teo Lachev book. Not exacly what i needed, but
> of figre if I could get that one running, I could modify it to call my
> custom
> RoleProvider. When I implemented the sample from the book, I get an
> exceiption when it calls the BinaryFormatter Deserialize method to
> deserialize SecDesc item that was passed to GetAccess. The error message
> i
> get is 'The input stream is not in a valid binary format. The starting
> contents (in bytes) are :06-05-00-9c...'
> Can anyone how a custom Authorization Extension is supposed to use the
> Security descriptors it gets from RS?
> Has anyone managed to use asp.net 2.0 RoleProviders with RS2005? Is
> there
> any good documentation on how to implement and deploy an
> IAuthorizationExtension? Should I be taking another approach?
>
> It Seems to me that there ought to be [supplied by microsoft] an
> implementation of the IAuthorizationExtension that calls a RoleProvider
> to
> determine what groups a user is in, but I have not been able to find it.
> Without this ability, the RoleProvider functionality is useless, because
> IT
> staff would need to maintain AD Groups to control access to reports while
> an
> Application Administrator would need to maintain RoleProvider Groups that
> control access to my pages. It sounds like if someone wants to use
> Reporting services, the should not be using a custom RoleProvider.
>
>|||Did you ever figure out how to cleare the old security descriptor ?
"gover" wrote:
> Just in case anyone else experiences this problem in the future , I thought
> I'd document what I've figured out so far. This is probably all buried in
> some documentation somewhere, but I've been unable to find it.
> When writing my pervious post, I had installed RS2005 and then installed a
> custom Authorization Extension and was getting an error saying 'The
> input stream is not in a valid binary format...'. when trying to access the
> root folder of the report server. I had copied much of the code from the
> Lachev book.
> The root folder of the report server was created at the time I installed
> RS2005. My custom Authorization Extension was not in place at the time the
> root folder was created , so the ACL for the folder was created serialized
> using the CreateSecurityDescriptor method of the default Authorization
> Extension that comes with RS2005 (i.e. the one that works with AD groups).
> I could browse to the root folder of the report server at this time with no
> problem.
> After I installed my custom Authorization Extension and browsed to the root
> folder, RS Passed the ACL created and serialized by the default
> Authorization Extension to my custom Authorization Extension. This caused
> the issue. The CreateSecurityDescriptor and the CheckAccess methods work
> hand-in-hand. The ACL create by CreateSecurityDescriptor of the default
> Authorization Extension could not be deserialized by the GetAccess method of
> my Custom Authorization Extension.
> Afterwards, I created a new folder. Because this new folder was created
> with my extension in place, the ACL was serialized by my own
> CreateSecurityDescriptor method, and thus could be deserialized by my own
> GetAccess method with no problem.
> I just can't access the root folder after having installedmy extension,
> because the security extension was not created by my code!.
>
> "gover" <gover@.discussions.microsoft.com> wrote in message
> news:03E811C4-6811-45EB-A071-0CAF14771C28@.microsoft.com...
> > We have developed a custom asp.net 2.0 RoleProvider to Authorize access
> > to
> > different areas of our web app so that administrators of our application
> > could control access rather than IT staff. The custom RoleProvider reads
> > user and role information from a SQLServer 2005 Database. We are not using
> > a
> > custom MembershipProvider. We are now trying to integrate Reporting
> > Services
> > 2005 with the Web App. I want the Roles used to authorize access to
> > reports
> > be the same roles that are used to authorize access to the pages in my web
> > app. I would like to have reporting services use my custom RoleProvider.
> > It
> > is my understanding that I need to create a class that implements
> > IAuthorizationExtension to do this.
> >
> > I have the example from the Teo Lachev book. Not exacly what i needed, but
> > of figre if I could get that one running, I could modify it to call my
> > custom
> > RoleProvider. When I implemented the sample from the book, I get an
> > exceiption when it calls the BinaryFormatter Deserialize method to
> > deserialize SecDesc item that was passed to GetAccess. The error message
> > i
> > get is 'The input stream is not in a valid binary format. The starting
> > contents (in bytes) are :06-05-00-9c...'
> >
> > Can anyone how a custom Authorization Extension is supposed to use the
> > Security descriptors it gets from RS?
> >
> > Has anyone managed to use asp.net 2.0 RoleProviders with RS2005? Is
> > there
> > any good documentation on how to implement and deploy an
> > IAuthorizationExtension? Should I be taking another approach?
> >
> >
> > It Seems to me that there ought to be [supplied by microsoft] an
> > implementation of the IAuthorizationExtension that calls a RoleProvider
> > to
> > determine what groups a user is in, but I have not been able to find it.
> > Without this ability, the RoleProvider functionality is useless, because
> > IT
> > staff would need to maintain AD Groups to control access to reports while
> > an
> > Application Administrator would need to maintain RoleProvider Groups that
> > control access to my pages. It sounds like if someone wants to use
> > Reporting services, the should not be using a custom RoleProvider.
> >
> >
> >
> >
>
>

Monday, March 26, 2012

I wonder if these ADO constants really work at all

For example why doesn't this give an error?
In a ASP:
<%@.language=3D"VBScript"%>
<%
'...
sSQL =3D "SELECT CustomerID, CompanyName, " & _ "ContactName, Country FROM Customers"
Set rs =3D Server.CreateObject("ADODB.Recordset")
rs.CursorType =3D adOpenForwardOnly
rs.Open sSQl, Application("DBconn")
rs.MoveNext
%>
<!-- HTML stuff -->
<%
rs.MoveFirst
'...
%>
<!-- HTML and ASP stuff -->
SQL 2000 SP3 ADO 2.7 SP(not sure) Windows 2000 SP3
-- George Hester
__________________________________What error were you expecting?
--
http://www.aspfaq.com/
(Reverse address to reply.)
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:%23uESkwAXEHA.2908@.TK2MSFTNGP10.phx.gbl...
For example why doesn't this give an error?|||> What error were you expecting?
About using forward only cursor backward.
I have seen an error in similar situation, but can't verify this now|||Right. What I provided should have resulted in a error but did not. =The adForwardOnly constant is NOT working. rs.MoveNext followed by =rs.MoveFirst should have resulted in a error at least that is my =understanding of a Recordset opened with that cursor type =adForwardOnly..
-- George Hester
__________________________________
"Bojidar Alexandrov" <bojo_do_no_spam@.kodar.net> wrote in message =news:OhiQ$IGXEHA.128@.TK2MSFTNGP10.phx.gbl...
> > What error were you expecting?
> > About using forward only cursor backward.
> > I have seen an error in similar situation, but can't verify this now
> >|||I'm not going to presume to know the reason(s) why, but MoveFirst() allows
you to just start over. The problem you will have with certain cursor types
is that you will not be able to move backwards, e.g. MovePrevious(). Also,
try a MoveLast() then a MoveFirst().
--
http://www.aspfaq.com/
(Reverse address to reply.)
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:ud6NnQKXEHA.1652@.TK2MSFTNGP09.phx.gbl...
Right. What I provided should have resulted in a error but did not. The
adForwardOnly constant is NOT working. rs.MoveNext followed by rs.MoveFirst
should have resulted in a error at least that is my understanding of a
Recordset opened with that cursor type adForwardOnly..|||On Sun, 27 Jun 2004 02:01:06 -0400, "George Hester"
<hesterloli@.hotmail.com> wrote:
>For example why doesn't this give an error?
My experience with ADO is that if you give a set of parameters that is
supposed to work, it will work, and if you give a set of parameters
that is an any way faulty, results are unpredictable in advance and
error messages unlikely.
I suspect this is pretty much as far as Microsoft's design and
development of ADO reaches.
J.|||Could you please explain in what I provided where the "faulty set of =parameters are?" I understand what you are saying but if the parameters =are not faultitly set then how does what you say apply to the issue as I =have presented it? If what I have done is "faulty" please tell me where =and I won't do it again.
-- George Hester
__________________________________
"JXStern" <JXSternChangeX2R@.gte.net> wrote in message =news:5io0e0t6ne26406u5712i0s7525dpthdbc@.4ax.com...
> On Sun, 27 Jun 2004 02:01:06 -0400, "George Hester"
> <hesterloli@.hotmail.com> wrote:
> >For example why doesn't this give an error?
> > My experience with ADO is that if you give a set of parameters that is
> supposed to work, it will work, and if you give a set of parameters
> that is an any way faulty, results are unpredictable in advance and
> error messages unlikely.
> > I suspect this is pretty much as far as Microsoft's design and
> development of ADO reaches.
> > J.
> >|||Aaron I am not sure I follow what you were saying. Are you saying that =what I presented is not supposed to give an error? If that is the case =could you please clarify if setting the cursor as adOpenForwardOnly and =then moving the Recordset rs.MoveNext and later rs.MoveFirst is not =contradicting the definition of adOpenForwardOnly? Because I seem to =misunderstand the definition of adOpenForwardOnly then. Thanks.
-- George Hester
__________________________________
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message =news:OmdlQpRXEHA.3168@.TK2MSFTNGP10.phx.gbl...
> I'm not going to presume to know the reason(s) why, but MoveFirst() =allows
> you to just start over. The problem you will have with certain cursor =types
> is that you will not be able to move backwards, e.g. MovePrevious(). =Also,
> try a MoveLast() then a MoveFirst().
> > -- > http://www.aspfaq.com/
> (Reverse address to reply.)
> > > > > "George Hester" <hesterloli@.hotmail.com> wrote in message
> news:ud6NnQKXEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Right. What I provided should have resulted in a error but did not. =The
> adForwardOnly constant is NOT working. rs.MoveNext followed by =rs.MoveFirst
> should have resulted in a error at least that is my understanding of a
> Recordset opened with that cursor type adForwardOnly..
> >|||Hi Aaron. I changed rs.MoveFirst to rs.MovePrevious and got the error =as expected. "Operation is not allowed in this context." Well that's =good. I guess rs.MoveFirst after one rs.MoveNext is different then =rs.MovePrevious after one rs.MoveNext. Because the later errors but the =former does not. Mmmm...
-- George Hester
__________________________________
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message =news:OmdlQpRXEHA.3168@.TK2MSFTNGP10.phx.gbl...
> I'm not going to presume to know the reason(s) why, but MoveFirst() =allows
> you to just start over. The problem you will have with certain cursor =types
> is that you will not be able to move backwards, e.g. MovePrevious(). =Also,
> try a MoveLast() then a MoveFirst().
> > -- > http://www.aspfaq.com/
> (Reverse address to reply.)
> > > > > "George Hester" <hesterloli@.hotmail.com> wrote in message
> news:ud6NnQKXEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Right. What I provided should have resulted in a error but did not. =The
> adForwardOnly constant is NOT working. rs.MoveNext followed by =rs.MoveFirst
> should have resulted in a error at least that is my understanding of a
> Recordset opened with that cursor type adForwardOnly..
> >|||> what I presented is not supposed to give an error? If that is the case
> could you please clarify if setting the cursor as adOpenForwardOnly and
> then moving the Recordset rs.MoveNext and later rs.MoveFirst is not
> contradicting the definition of adOpenForwardOnly?
If I drive on a one way street, and then do it again, I haven't broken any
law. The constant is not called adOpenForwardOnlyAndOnlyDoItOnce. ;-)
--
http://www.aspfaq.com/
(Reverse address to reply.)|||I agree that makes sense. Consider this using Cursor Type =adOpenForwardOnly
<%
'--
rs.MoveNext
'--
rs.MoveFirst
'--
%>
Gives no error as we have seen. So in the same vein let's try this:
<%
'--
rs.MoveLast
'--
rs.MoveFirst
'--
%>
This DOES give an error namely:
Microsoft OLE DB Provider for SQL Server error '80040e24' Rowset does not support fetching backward.
So you got a pretty funky One-Way street there. If I go to the end of =the road I can't go back. But if I only go a little bit down the road I =can start over if I choose. I'm not trying to beat a dead horse just =trying to understand visualize what is going on here. It seems to me if =the recordset had only two records then both would error. That would be =consistent. I guess that's the next test.
-- George Hester
__________________________________
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message =news:u#FUS8cXEHA.2844@.TK2MSFTNGP11.phx.gbl...
> > what I presented is not supposed to give an error? If that is the =case > > could you please clarify if setting the cursor as adOpenForwardOnly =and > > then moving the Recordset rs.MoveNext and later rs.MoveFirst is not > > contradicting the definition of adOpenForwardOnly?
> > If I drive on a one way street, and then do it again, I haven't broken =any > law. The constant is not called adOpenForwardOnlyAndOnlyDoItOnce. =;-)
> > -- > http://www.aspfaq.com/
> (Reverse address to reply.) > >|||On Tue, 29 Jun 2004 01:32:36 -0400, "George Hester"
<hesterloli@.hotmail.com> wrote:
>Could you please explain in what I provided where the
>"faulty set of parameters are?" I understand what you
>are saying but if the parameters are not faultitly set
>then how does what you say apply to the issue as I have
>presented it? If what I have done is "faulty" please
>tell me where and I won't do it again.
I can't recall whether a forwardonly cursor is supposed to allow a
.MoveFirst(), but probably not, and that is where YOU expected it to
give you an error. Under the circumstances, this is what I meant by
"faulty parameters". I'm not shocked that there was no error message.
But, you didn't tell us what the program *does* when it hits that
point - does the .MoveFirst() execute correctly and let you rerun the
data? If so, you've discovered an undocumented feature, maybe, but
then there were no faulty parameters and no error message should have
been expected.
J.|||It seems to me like some cache :)
What happen if do
<%
'--
rs.MoveNext
'--
rs.MoveNext
'--
rs.MoveFirst
'--
%>
I again cannot test here...
Bojidar Alexandrov
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:uFeceAgXEHA.3640@.TK2MSFTNGP11.phx.gbl...
I agree that makes sense. Consider this using Cursor Type adOpenForwardOnly
<%
'--
rs.MoveNext
'--
rs.MoveFirst
'--
%>
Gives no error as we have seen. So in the same vein let's try this:
<%
'--
rs.MoveLast
'--
rs.MoveFirst
'--
%>
This DOES give an error namely:
Microsoft OLE DB Provider for SQL Server error '80040e24'
Rowset does not support fetching backward.
So you got a pretty funky One-Way street there. If I go to the end of the
road I can't go back. But if I only go a little bit down the road I can
start over if I choose. I'm not trying to beat a dead horse just trying to
understand visualize what is going on here. It seems to me if the recordset
had only two records then both would error. That would be consistent. I
guess that's the next test.
--
George Hester
__________________________________
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:u#FUS8cXEHA.2844@.TK2MSFTNGP11.phx.gbl...
> > what I presented is not supposed to give an error? If that is the case
> > could you please clarify if setting the cursor as adOpenForwardOnly and
> > then moving the Recordset rs.MoveNext and later rs.MoveFirst is not
> > contradicting the definition of adOpenForwardOnly?
> If I drive on a one way street, and then do it again, I haven't broken any
> law. The constant is not called adOpenForwardOnlyAndOnlyDoItOnce. ;-)
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>|||Now that is a good question. See I really expected the error to occur =at .MoveFirst. It didn't. But to really see if it did what was =expected I need to make sure that after .MoveNext and then .MoveFirst =the entire recordset is returned.
I haven't really investigated it that much. I am at the moment doing =something a little different. But I should be able to answer both your =and the above interogatories by this weekend.
-- George Hester
__________________________________
"JXStern" <JXSternChangeX2R@.gte.net> wrote in message =news:odu3e0hbedpv3sbab4h4edthi5ierbnoco@.4ax.com...
> On Tue, 29 Jun 2004 01:32:36 -0400, "George Hester"
> <hesterloli@.hotmail.com> wrote:
> > >Could you please explain in what I provided where the > >"faulty set of parameters are?" I understand what you > >are saying but if the parameters are not faultitly set > >then how does what you say apply to the issue as I have > >presented it? If what I have done is "faulty" please > >tell me where and I won't do it again.
> > I can't recall whether a forwardonly cursor is supposed to allow a
> .MoveFirst(), but probably not, and that is where YOU expected it to
> give you an error. Under the circumstances, this is what I meant by
> "faulty parameters". I'm not shocked that there was no error message.
> But, you didn't tell us what the program *does* when it hits that
> point - does the .MoveFirst() execute correctly and let you rerun the
> data? If so, you've discovered an undocumented feature, maybe, but
> then there were no faulty parameters and no error message should have
> been expected.
> > J.
> >|||Yeah OK. The recordset returns returns 268 records without the =.MoveNext first followed by the .MoveFirst before writing the recordset =to the client (asp).
With the .MoveNext followed by the .MoveFirst the recordset returns 268 =records. If I do .MoveLast followed by .MoveFirst then yes there is an =error as I described earlier. Next on the agenda is two .MoveNext's =followed by the .MoveFirst. The answer to that will be under Bojidar's =post.
Remember the Reordset is opened with rs.CursorType=3DadOpenForwardOnly:
<%
Option Explicit
Dim cn, cmd, rs, sSQL, pBeginDate, pEndDate, lRecs, i
sSQL =3D "EXEC [Employee Sales by Country] '19980101','19981231'"
Set cn =3D Server.CreateObject("ADODB.Connection")
i =3D 1
cn.Open(Application("DBconn"))
Set rs =3D Server.CreateObject("ADODB.Recordset")
'
rs.CursorType =3D adOpenForwardOnly
Set rs =3D cn.Execute(sSQL, lRecs, adCmdText)
If rs.EOF Then
Response.Write("No records found")
Else
rs.MoveNext
%>
<!-- Writing the recordset here using ASP and HTML -->
<%
'rs.MoveFirst
'.......
%>
End If
Response.End
'...
%>
The last thing to check is if the Recordset only contains two =records...I just have to find the right parameter for that in the SQL.
-- George Hester
__________________________________
"George Hester" <hesterloli@.hotmail.com> wrote in message =news:#py06C8XEHA.3120@.TK2MSFTNGP12.phx.gbl...
Now that is a good question. See I really expected the error to occur =at .MoveFirst. It didn't. But to really see if it did what was =expected I need to make sure that after .MoveNext and then .MoveFirst =the entire recordset is returned.
I haven't really investigated it that much. I am at the moment doing =something a little different. But I should be able to answer both your =and the above interogatories by this weekend.
-- George Hester
__________________________________
"JXStern" <JXSternChangeX2R@.gte.net> wrote in message =news:odu3e0hbedpv3sbab4h4edthi5ierbnoco@.4ax.com...
> On Tue, 29 Jun 2004 01:32:36 -0400, "George Hester"
> <hesterloli@.hotmail.com> wrote:
> > >Could you please explain in what I provided where the > >"faulty set of parameters are?" I understand what you > >are saying but if the parameters are not faultitly set > >then how does what you say apply to the issue as I have > >presented it? If what I have done is "faulty" please > >tell me where and I won't do it again.
> > I can't recall whether a forwardonly cursor is supposed to allow a
> .MoveFirst(), but probably not, and that is where YOU expected it to
> give you an error. Under the circumstances, this is what I meant by
> "faulty parameters". I'm not shocked that there was no error message.
> But, you didn't tell us what the program *does* when it hits that
> point - does the .MoveFirst() execute correctly and let you rerun the
> data? If so, you've discovered an undocumented feature, maybe, but
> then there were no faulty parameters and no error message should have
> been expected.
> > J.
> >|||Nope no error with and without .rs.MoveNext followed by .rs.MoveFirst =and with rs.MoveNext rs.MoveNext followed by rs.MoveFirst. No error and =the same number of records are returned as with none of these =shanaigans.
Last test is the 2 record recordset...
-- George Hester
__________________________________
"Bojidar Alexandrov" <bojo_do_no_spam@.kodar.net> wrote in message =news:OLsNX7qXEHA.1356@.TK2MSFTNGP09.phx.gbl...
> It seems to me like some cache :)
> > What happen if do
> <%
> '--
> rs.MoveNext
> '--
> rs.MoveNext
> '--
> rs.MoveFirst
> '--
> %>
> > > I again cannot test here...
> > > Bojidar Alexandrov
> "George Hester" <hesterloli@.hotmail.com> wrote in message
> news:uFeceAgXEHA.3640@.TK2MSFTNGP11.phx.gbl...
> I agree that makes sense. Consider this using Cursor Type =adOpenForwardOnly
> > <%
> '--
> rs.MoveNext
> '--
> rs.MoveFirst
> '--
> %>
> > Gives no error as we have seen. So in the same vein let's try this:
> > <%
> '--
> rs.MoveLast
> '--
> rs.MoveFirst
> '--
> %>
> > This DOES give an error namely:
> > Microsoft OLE DB Provider for SQL Server error '80040e24'
> Rowset does not support fetching backward.
> > So you got a pretty funky One-Way street there. If I go to the end of =the
> road I can't go back. But if I only go a little bit down the road I =can
> start over if I choose. I'm not trying to beat a dead horse just =trying to
> understand visualize what is going on here. It seems to me if the =recordset
> had only two records then both would error. That would be consistent. = I
> guess that's the next test.
> > -- > George Hester
> __________________________________
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:u#FUS8cXEHA.2844@.TK2MSFTNGP11.phx.gbl...
> > > what I presented is not supposed to give an error? If that is the =case
> > > could you please clarify if setting the cursor as =adOpenForwardOnly and
> > > then moving the Recordset rs.MoveNext and later rs.MoveFirst is =not
> > > contradicting the definition of adOpenForwardOnly?
> >
> > If I drive on a one way street, and then do it again, I haven't =broken any
> > law. The constant is not called adOpenForwardOnlyAndOnlyDoItOnce. =;-)
> >
> > -- > > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >|||Well I don't get it. I set the:
sSQL =3D "EXEC [Employee Sales by Country] '19980505', '19980505'"
This returns two records. The rs.MoveNext sems to do nothing. Only the =.rs.MoveLast followed by rs.MoveFirst gives the error. So I tried this:
rs.MoveNext then wrote this recodset (no rs.MoveFirst). Only one record =was returned as expected. But putting in rs.MoveFirst after this =rs.MoveNext two are returned. I'm not happy with this.
-- George Hester
__________________________________
"Bojidar Alexandrov" <bojo_do_no_spam@.kodar.net> wrote in message =news:OLsNX7qXEHA.1356@.TK2MSFTNGP09.phx.gbl...
> It seems to me like some cache :)
> > What happen if do
> <%
> '--
> rs.MoveNext
> '--
> rs.MoveNext
> '--
> rs.MoveFirst
> '--
> %>
> > > I again cannot test here...
> > > Bojidar Alexandrov
> "George Hester" <hesterloli@.hotmail.com> wrote in message
> news:uFeceAgXEHA.3640@.TK2MSFTNGP11.phx.gbl...
> I agree that makes sense. Consider this using Cursor Type =adOpenForwardOnly
> > <%
> '--
> rs.MoveNext
> '--
> rs.MoveFirst
> '--
> %>
> > Gives no error as we have seen. So in the same vein let's try this:
> > <%
> '--
> rs.MoveLast
> '--
> rs.MoveFirst
> '--
> %>
> > This DOES give an error namely:
> > Microsoft OLE DB Provider for SQL Server error '80040e24'
> Rowset does not support fetching backward.
> > So you got a pretty funky One-Way street there. If I go to the end of =the
> road I can't go back. But if I only go a little bit down the road I =can
> start over if I choose. I'm not trying to beat a dead horse just =trying to
> understand visualize what is going on here. It seems to me if the =recordset
> had only two records then both would error. That would be consistent. = I
> guess that's the next test.
> > -- > George Hester
> __________________________________
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:u#FUS8cXEHA.2844@.TK2MSFTNGP11.phx.gbl...
> > > what I presented is not supposed to give an error? If that is the =case
> > > could you please clarify if setting the cursor as =adOpenForwardOnly and
> > > then moving the Recordset rs.MoveNext and later rs.MoveFirst is =not
> > > contradicting the definition of adOpenForwardOnly?
> >
> > If I drive on a one way street, and then do it again, I haven't =broken any
> > law. The constant is not called adOpenForwardOnlyAndOnlyDoItOnce. =;-)
> >
> > -- > > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >

I wasnt to learn all the possible ways of accessing Data in ASP .net 2.0

Hello.

I would like to learn all the possible ways that we can access and modify data in ASP .net 2.0 programmatically.

for example one way would be like this:


StringBuilder sql = new StringBuilder();
sql.Append(" SELECT *"); //count the total number of records
sql.Append(" FROM dbo.tblJobTitle ");

//get the connection string from web services
string strConnection = new sqlconnection.SQLConnection().GetSQLConnectString(sqlconnection.SQLDSN.SCIC);

//Use the Microsoft.practices SqlDatabase object to execute our sql.
SqlDatabase SqlHelper = new SqlDatabase(strConnection);
SqlDataReader reader = (SqlDataReader)SqlHelper.ExecuteReader(CommandType.Text, sql.ToString());

the i can loop through reader and get the data OR I can create a DataSet like this:

SqlDatabase db = new SqlDatabase(strConnection);
DbCommand dbCommand = db.GetSqlStringCommand(sql.ToString());
DataSet dst = db.ExecuteDataSet(dbCommand);

I want to know if there is a comprehensive book explainaning all these possible ways to access and modify data using C# under ASP .net 2.0

I really really apreciate this.

Thank you very much.


I think you suit almost all books about ADO.NET because ADO is a part of .NET framework platform as ASP.NET. Also you can read almost all book about C# 2.0 because 100% chances that inside is chapters about ADO.|||

Common, who can read all the books in the world ?

Is there any more practical way or learning them ? Like reading a specific book or a website or MSDN or ....

Honestly I am eager to learn them and I want to learn it in a good way, start from easy stuff to more difficult and pro ways of doing it.


Thanks

|||

Hmm, if what you want is a more practical way to learn ado.net, i would suggest you : 1. Install MSDN 2.Open your browser and google "ado.net c# source code" .You will find pretty a lot of results.

Read those codes line by line and if you find anything you cannot understand, look it up in msdn. That's the way how i learn ado.net.

Hope it helps

Friday, March 23, 2012

I want urgent help

Hi,
I have created cube in sql server 2005. I want to use that cube from the front end that is using asp.net application I know that for this u require OWC(Office Web Component). I have installed that also. So can anybody help me to integrate all these stubs together.

Thanks In advance

Sach

Try this You will not need OWC. Remember OWC is not going to be supported in future.

The CellSetGrid is open source ASP.NET based OLAP browser: http://www.sqlserveranalysisservices.com/cellsetgrid/CellSetGridIntro.htm

I doesn't mean to sell you different solutions to you but If you need Web interface for Cube also try Sharepoint Services and Pivot Table web part. I found best solution, quick and free if you have Windows 2003 Server OS. But yes you will be using OWC in this case.

- Ashok

Wednesday, March 21, 2012

I want to know how to use ADO.net connect remote datebase

Im the new in ASP.net.
I find no way to connect remote datebase(sql server 2000).
Everybody who have ways help me.
Thank you!Sorry!!It's database not datebase!!HA~~|||::I find no way to connect remote datebase(sql server 2000).
::Everybody who have ways help me.

Would be a ton of help.

Read up on ADO.NET in the documentation.|||thank you!!
but could you give me some samples!!
i want use ASP.net to connect remote database to display data!!

Monday, March 19, 2012

I want source control for SQL Server 2000...

Hi guys'n'girls...

I currently work for a company where we develop several large ASP.NET applications which are VERY data centric. But lately we have run into a problem on our developer DB...

On the project I am working on we currenctly have approx. 10 developers working concurrently on the database. That means that we often run into errors caused by two developers working on the same stored procedure, function or trigger so the developer who adds his changes last, overwrites the modifications done by the other developer. The obvious answer is source control for the db, but as far as I can tell this is only available for stored procedures and not for functions or triggers... And even the stored procedure solution isn't very safe because it only works if every developer is editing the procedures through VS.

So what do we do? There must be some solution to this problem... And I'm pretty convinced that we are not the first company to face this problem. Are we doing it the wrong way or do you know another solution?

Thanks in advance!

Try these two urls for options but the manual way to do it is to leave the DDL coding to one or two developers working together and run a stored proc to eliminate duplicates. Hope this helps.


http://www.allisonfamily.org/bill/library/articles/vss-sql-howto/

http://www.sqlservercentral.com/products/bwunder/archiveutility/

Sunday, February 19, 2012

I need help in purchasing sql server 2005

Hi everyone, I have a web application (ASP.NET 2.0) where user will access database informations (read, write) from the application (So the SQL server is not directly exposed to the internet). These users will be authenticated from the applications itself (Not using NT/AD authentications). My question is should I get the SQL server 2005 with license(s) processor? Or should I buy the one with 5 cals ? Thanks ...

You cannot use a User CAL for a web server that access a SQL Server - you will need a device CAL instead. You therefore need to consider whether a processor license is cheaper than a license + device CAL. Your best bet is to ring up a couple of SQL Server resellers, describe your scenario and get them to quote you some prices. Then choose the best.