Hi,
I have a client program in vb.net that access a SQL server database. Each
time the client program need some data it retrieve the whole table, so it is
pretty slow.
I wonder if it is possible, for the client, to retrieve only a window of
rows around the actual value he is using. That is, if he is actually in row
4000 he will retrieve from row 3000 to 5000 but not the complete table. If
this is possible what I need is something like:
1) The client send SQL-Server a string with the actual ordering and the ID
of the actual row.
2) SQL-Server order the table following the order specified in the string
send by the client.
3) Using the ordered table SQL-Server "find" the ID of the actual row.
4) SQL-Server return a number of rows before and after the Id of the actual
row (no idea how to do this).
Any help.
Thanks,
JamesHi James,
Yes - its basically paging.
The basics are this...
declare @.results table (
idrow int not null identity,
yourresultcol1...
yourresultcol2...
)
insert @.results ( yourresultscol1, yourresultscol2 )
select yourresultscol1, yourresultscol2
from table...
where ...
order by ...
select *
from @.results
where idrow between @.start and @.finish
I know its not a complete working example but does that give you enough
idea?
Tony
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"James" <info@.pricetech.es> wrote in message
news:OTkWPANHGHA.1628@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I have a client program in vb.net that access a SQL server database. Each
> time the client program need some data it retrieve the whole table, so it
> is pretty slow.
> I wonder if it is possible, for the client, to retrieve only a window of
> rows around the actual value he is using. That is, if he is actually in
> row 4000 he will retrieve from row 3000 to 5000 but not the complete
> table. If this is possible what I need is something like:
> 1) The client send SQL-Server a string with the actual ordering and the ID
> of the actual row.
> 2) SQL-Server order the table following the order specified in the string
> send by the client.
> 3) Using the ordered table SQL-Server "find" the ID of the actual row.
> 4) SQL-Server return a number of rows before and after the Id of the
> actual row (no idea how to do this).
> Any help.
> Thanks,
> James
>
>|||Sorry, i forgot to mention, in SQL 2005 its a whole lot easier.
We have the rownumber() function and cte that does it all for us - there are
some really useful examples in bol.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"Tony Rogerson" <tonyrogerson@.sqlserverfaq.com> wrote in message
news:uhnuUbNHGHA.1124@.TK2MSFTNGP10.phx.gbl...
> Hi James,
> Yes - its basically paging.
> The basics are this...
> declare @.results table (
> idrow int not null identity,
> yourresultcol1...
> yourresultcol2...
> )
> insert @.results ( yourresultscol1, yourresultscol2 )
> select yourresultscol1, yourresultscol2
> from table...
> where ...
> order by ...
> select *
> from @.results
> where idrow between @.start and @.finish
> I know its not a complete working example but does that give you enough
> idea?
> Tony
> --
> Tony Rogerson
> SQL Server MVP
> http://sqlserverfaq.com - free video tutorials
>
> "James" <info@.pricetech.es> wrote in message
> news:OTkWPANHGHA.1628@.TK2MSFTNGP12.phx.gbl...
>|||James
I think Tom Moreau had already answered the same or almost the same question
a few days ago. Pls search on internet
"James" <info@.pricetech.es> wrote in message
news:OTkWPANHGHA.1628@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I have a client program in vb.net that access a SQL server database. Each
> time the client program need some data it retrieve the whole table, so it
> is pretty slow.
> I wonder if it is possible, for the client, to retrieve only a window of
> rows around the actual value he is using. That is, if he is actually in
> row 4000 he will retrieve from row 3000 to 5000 but not the complete
> table. If this is possible what I need is something like:
> 1) The client send SQL-Server a string with the actual ordering and the ID
> of the actual row.
> 2) SQL-Server order the table following the order specified in the string
> send by the client.
> 3) Using the ordered table SQL-Server "find" the ID of the actual row.
> 4) SQL-Server return a number of rows before and after the Id of the
> actual row (no idea how to do this).
> Any help.
> Thanks,
> James
>
>|||James wrote:
> Hi,
> I have a client program in vb.net that access a SQL server database. Each
> time the client program need some data it retrieve the whole table, so it
is
> pretty slow.
> I wonder if it is possible, for the client, to retrieve only a window of
> rows around the actual value he is using. That is, if he is actually in ro
w
> 4000 he will retrieve from row 3000 to 5000 but not the complete table. If
> this is possible what I need is something like:
> 1) The client send SQL-Server a string with the actual ordering and the ID
> of the actual row.
> 2) SQL-Server order the table following the order specified in the string
> send by the client.
> 3) Using the ordered table SQL-Server "find" the ID of the actual row.
> 4) SQL-Server return a number of rows before and after the Id of the actua
l
> row (no idea how to do this).
> Any help.
> Thanks,
> James
Take a look at:
http://www.aspfaq.com/show.asp?id=2120
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Showing posts with label program. Show all posts
Showing posts with label program. Show all posts
Wednesday, March 21, 2012
Wednesday, March 7, 2012
Help needed
Hi,
I have program to make invoice called "primavera" that uses crystal reports.
I need to insert the logo in the report.
I have downloaded a free trial of Cristal report 11.
When I open the file it gives the message:" The saved data will be discarded since one or more formulas failed to compile"
I insert the logo in the file but the "primavera" doesn't assume the changes.
Can someone help me please?
Thank you.I already encounter this problem. You used a formula in a section expert or anywhere in the report but you delete the formula without delete it first in section expert or anywhere in the report.
I have program to make invoice called "primavera" that uses crystal reports.
I need to insert the logo in the report.
I have downloaded a free trial of Cristal report 11.
When I open the file it gives the message:" The saved data will be discarded since one or more formulas failed to compile"
I insert the logo in the file but the "primavera" doesn't assume the changes.
Can someone help me please?
Thank you.I already encounter this problem. You used a formula in a section expert or anywhere in the report but you delete the formula without delete it first in section expert or anywhere in the report.
Friday, February 24, 2012
Help me the webapplication cannot run
When I setup the msde2000 and use Vc#.net create program webapplication for show the database on web.
I use the Datagrid control for show the result database on web. In the IDE of Vc# I use Server Exploler select the Northwind.mdf and drag&drop the table Customers and create sqlDataAdapter, sqlConnection and dataSet for it.
and contain it to the datagrid. Final I write the source code for it
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
sqlDataAdapter1.Fill(dataSet11);
DataGrid1.DataBind();
}
the Vc# compile is completed. and the webapp. is show complete too.
But When I create new database in Server Exploler (ETC test.mdf ) and create table in the database.(table name is 'TEST')
And now I create field id and name. And input the value in the id and name.
And then the every step is same when I use the northwind.mdf ...
And compile the program ... Vc# IDE is compile complete ..no error But the webapp is show
Server Error in '/dbtest2' Application.
Cannot open database requested in login 'test'. Login fails. Login failed for user 'COMPUTER\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot open database requested in login 'test'. Login fails. Login failed for user 'COMPUTER\ASPNET'.
Source Error:
Line 29: {
Line 30: // Put user code to initialize the page here
Line 31: sqlDataAdapter1.Fill(dataSet11);
Line 32: DataGrid1.DataBind();
Line 33: }
Source File: c:\inetpub\wwwroot\dbtest2\webform1.aspx.cs Line: 31
Help me for the problem. I think the test.mdf is not permission to the use it.But the northwind can...
How i create the database looklike to northwind Because the northwind is not error but the new database is error
p.s. my computer name is COMPUTER
system .... winxp+ sp1
....vs.net 2002
.... msde include in vs.net and setup by advice of the Net framwork sdk ''sample and quickstart tutorial
thank you
Hi Aurora,
It looks like the ASPNET account on your computer has not been given
permission to access the database you are using. Check the logon/permissions
for this user using Enterprise Manager (if you have it) or you could use the
personal edition (free) of our MSDE Manager (at our site) to do it.
HTH,
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com
"Aurora" <tooktoon55@.hotmail.com> wrote in message
news:25504584-238B-4D97-8A34-284C437F3413@.microsoft.com...
> When I setup the msde2000 and use Vc#.net create program webapplication
for show the database on web.
> I use the Datagrid control for show the result database on web. In the
IDE of Vc# I use Server Exploler select the Northwind.mdf and drag&drop the
table Customers and create sqlDataAdapter, sqlConnection and dataSet for it.
> and contain it to the datagrid. Final I write the source code for it
> private void Page_Load(object sender, System.EventArgs e)
> {
> // Put user code to initialize the page here
> sqlDataAdapter1.Fill(dataSet11);
> DataGrid1.DataBind();
> }
> the Vc# compile is completed. and the webapp. is show complete too.
> But When I create new database in Server Exploler (ETC test.mdf ) and
create table in the database.(table name is 'TEST')
> And now I create field id and name. And input the value in the id and
name.
> And then the every step is same when I use the northwind.mdf ...
> And compile the program ... Vc# IDE is compile complete ..no error But
the webapp is show
> Server Error in '/dbtest2' Application.
> ----
--
> Cannot open database requested in login 'test'. Login fails. Login failed
for user 'COMPUTER\ASPNET'.
> Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
> Exception Details: System.Data.SqlClient.SqlException: Cannot open
database requested in login 'test'. Login fails. Login failed for user
'COMPUTER\ASPNET'.
> Source Error:
>
> Line 29: {
> Line 30: // Put user code to initialize the page here
> Line 31: sqlDataAdapter1.Fill(dataSet11);
> Line 32: DataGrid1.DataBind();
> Line 33: }
>
> Source File: c:\inetpub\wwwroot\dbtest2\webform1.aspx.cs Line: 31
> Help me for the problem. I think the test.mdf is not permission to the use
it.But the northwind can...
> How i create the database looklike to northwind Because the northwind is
not error but the new database is error
> p.s. my computer name is COMPUTER
> system .... winxp+ sp1
> ....vs.net 2002
> .... msde include in vs.net and setup by advice of the Net
framwork sdk ''sample and quickstart tutorial
> thank you
>
|||Msde Manager use .Net 1.1 ?
my system is install .Net 1.0. I download msde manager form your web But cannot install.
|||Hi Aurora,
Yes. In that case, just use the other standard win32 version (ie the
non-.NET version).
HTH,
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com
"aurora" <anonymous@.discussions.microsoft.com> wrote in message
news:561E9539-392C-411B-8C46-1FB16922974C@.microsoft.com...
> Msde Manager use .Net 1.1 ?
> my system is install .Net 1.0. I download msde manager form your web But
cannot install.
>
I use the Datagrid control for show the result database on web. In the IDE of Vc# I use Server Exploler select the Northwind.mdf and drag&drop the table Customers and create sqlDataAdapter, sqlConnection and dataSet for it.
and contain it to the datagrid. Final I write the source code for it
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
sqlDataAdapter1.Fill(dataSet11);
DataGrid1.DataBind();
}
the Vc# compile is completed. and the webapp. is show complete too.
But When I create new database in Server Exploler (ETC test.mdf ) and create table in the database.(table name is 'TEST')
And now I create field id and name. And input the value in the id and name.
And then the every step is same when I use the northwind.mdf ...
And compile the program ... Vc# IDE is compile complete ..no error But the webapp is show
Server Error in '/dbtest2' Application.
Cannot open database requested in login 'test'. Login fails. Login failed for user 'COMPUTER\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot open database requested in login 'test'. Login fails. Login failed for user 'COMPUTER\ASPNET'.
Source Error:
Line 29: {
Line 30: // Put user code to initialize the page here
Line 31: sqlDataAdapter1.Fill(dataSet11);
Line 32: DataGrid1.DataBind();
Line 33: }
Source File: c:\inetpub\wwwroot\dbtest2\webform1.aspx.cs Line: 31
Help me for the problem. I think the test.mdf is not permission to the use it.But the northwind can...
How i create the database looklike to northwind Because the northwind is not error but the new database is error
p.s. my computer name is COMPUTER
system .... winxp+ sp1
....vs.net 2002
.... msde include in vs.net and setup by advice of the Net framwork sdk ''sample and quickstart tutorial
thank you
Hi Aurora,
It looks like the ASPNET account on your computer has not been given
permission to access the database you are using. Check the logon/permissions
for this user using Enterprise Manager (if you have it) or you could use the
personal edition (free) of our MSDE Manager (at our site) to do it.
HTH,
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com
"Aurora" <tooktoon55@.hotmail.com> wrote in message
news:25504584-238B-4D97-8A34-284C437F3413@.microsoft.com...
> When I setup the msde2000 and use Vc#.net create program webapplication
for show the database on web.
> I use the Datagrid control for show the result database on web. In the
IDE of Vc# I use Server Exploler select the Northwind.mdf and drag&drop the
table Customers and create sqlDataAdapter, sqlConnection and dataSet for it.
> and contain it to the datagrid. Final I write the source code for it
> private void Page_Load(object sender, System.EventArgs e)
> {
> // Put user code to initialize the page here
> sqlDataAdapter1.Fill(dataSet11);
> DataGrid1.DataBind();
> }
> the Vc# compile is completed. and the webapp. is show complete too.
> But When I create new database in Server Exploler (ETC test.mdf ) and
create table in the database.(table name is 'TEST')
> And now I create field id and name. And input the value in the id and
name.
> And then the every step is same when I use the northwind.mdf ...
> And compile the program ... Vc# IDE is compile complete ..no error But
the webapp is show
> Server Error in '/dbtest2' Application.
> ----
--
> Cannot open database requested in login 'test'. Login fails. Login failed
for user 'COMPUTER\ASPNET'.
> Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
> Exception Details: System.Data.SqlClient.SqlException: Cannot open
database requested in login 'test'. Login fails. Login failed for user
'COMPUTER\ASPNET'.
> Source Error:
>
> Line 29: {
> Line 30: // Put user code to initialize the page here
> Line 31: sqlDataAdapter1.Fill(dataSet11);
> Line 32: DataGrid1.DataBind();
> Line 33: }
>
> Source File: c:\inetpub\wwwroot\dbtest2\webform1.aspx.cs Line: 31
> Help me for the problem. I think the test.mdf is not permission to the use
it.But the northwind can...
> How i create the database looklike to northwind Because the northwind is
not error but the new database is error
> p.s. my computer name is COMPUTER
> system .... winxp+ sp1
> ....vs.net 2002
> .... msde include in vs.net and setup by advice of the Net
framwork sdk ''sample and quickstart tutorial
> thank you
>
|||Msde Manager use .Net 1.1 ?
my system is install .Net 1.0. I download msde manager form your web But cannot install.
|||Hi Aurora,
Yes. In that case, just use the other standard win32 version (ie the
non-.NET version).
HTH,
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com
"aurora" <anonymous@.discussions.microsoft.com> wrote in message
news:561E9539-392C-411B-8C46-1FB16922974C@.microsoft.com...
> Msde Manager use .Net 1.1 ?
> my system is install .Net 1.0. I download msde manager form your web But
cannot install.
>
help me set up msde
I just installed MSDE off of disk that came with teach yourself asp.net in 24 hours. To get the program started you must go to run and type cmd and wait for the C prompt. I get this far, but I can't get a C prompt. It always comes up C:\sql2ksp3> How do I get a C prompt from here. I know it must be something easy that I am just overlooking or forgot.
Thanks
Del Dobbscd \
Thanks
Del Dobbscd \
not that is matters a lot.
Subscribe to:
Posts (Atom)