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

Friday, March 23, 2012

query for recordset data into sql table

Hi,

i have a recordset on an asp page and put into session now i want to move this recordset data from session to sql server table.how can i query this.Pls suggest me...

any suggestion will be appriciable...

Thanks

Hi,

depending on your version of ASP the work to be done can differ, but here is the ASP.NET 2.0 approach, if you have the data in the session:

-Get the data from the session
-cast it to a usable data object (like datatable)
-Use a sqlcommand or datadapter to update the data on the database
(depending on your implemented database interface, DML Command Access or SP access this can differ)


HTH; Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

thanks jens for the information ...

but i am using classic ASP recordset

Saturday, February 25, 2012

Query by database or code

I have a database and would like to retrieve specific data via queries. This database is also connected to an ASP .Net 2.0 application to be the front end. Ive created the query in the database. Would you recommend i use parameter names to retrieve the data via code or should i have the query within my code to retrieve the data?

Thanks

I'm not exactly sure what you are asking. Are you asking whether or not to do your database access from the ASPX page or the code-behind? Or, are you asking if you should parameterize your queries?

|||

Im using ASP.Net to create a website and heres and example of how i retrieve the data:

Dim strCommandText as String= "SELECT * FROM Player INNER JOIN Manufacturer ON Player.PlayerManufacturerID =
Manufacturer.ManufacturerID ORDER BY Player.PlayerName"
Dim myCommand As SqlCommand = new SqlCommand(strCommandText, myConnection)

Now above i write the SQL syntax into my application to retrieve data. If i have a query created within the DATABASE called ParameterName then i can write the code as:

MyCommand.Paramters.Add(ParameterName)

So my question is really asking which method is approved and why as theyre both doing the same thing?

Thanks

|||

If I still misunderstood your question, then my apologies, but I think what you're asking is if your Select statement requires parameters, then should I inject them directly into my statement, or use a parameter, and add the parameters afterwards. If this is what you're truly asking, then I'd definetely suggest the use of parameters as they create a much less error-proned design. Here's an article on the subject:

http://www.4guysfromrolla.com/webtech/092601-1.shtml

|||

The "common" best practice approach would be to have a separate class library that will return the "Players" via a stored procedure. I would also recommend not using SELECT *, you should only select the fields you need.

|||

If I still misunderstood your question, then my apologies, but I think what you're asking is if your Select statement requires parameters, then should I inject them directly into my statement, or use a parameter, and add the parameters afterwards. If this is what you're truly asking, then I'd definetely suggest the use of parameters as they create a much less error-proned design. Here's an article on the subject:

http://www.4guysfromrolla.com/webtech/092601-1.shtml

Not quite. Im just trying to see if i should use a Select query in my code or should i call aparameter Stored Procedure from the database to retrieve the data. Sorry my fault i was using the wrong terminology, i should have said Stored Procedure but got my wires crossed as ASP .Net terms this as a parameter being passed in to the code your writing

jguadagno:

The "common" best practice approach would be to have a separate class library that will return the "Players" via a stored procedure. I would also recommend not using SELECT *, you should only select the fields you need.

I think this may have answered the question. Where can i get started with Class libraries? also thanks for advising not to use SELECT * - i only used that in this question as an example.

Thanks guys

|||

EssCee:

I think this may have answered the question. Where can i get started with Class libraries?

http://www.15seconds.com/issue/050721.htm

Monday, February 20, 2012

Query Analyzer?

Experts,
I have a standard SQL 2000 installed onto a Windows 2003 Server on which I
am a local administrator. An IIS server by way of ASP.NET uses this SQL
database server as it's back-end. Someone told me there is a way in SQL to
see who is using the database via the ASP>NET front-end on the IIS server.
Something called Query Analyzer I believe. How do I get to that in SQL? I
am such a SQL novice that I'm afraid I'll need the exact steps to click to
fire this thing up. :-)
Spin
Query Analyser is a query tool that comes with SQL Server 2000 (as part
of Microsoft's "client tools"). You run it from the Start menu (Start |
All Programs | Microsoft SQL Server | Query Analyzer).
However, just running QA (Query Analyser) probably won't help you as you
need to know what queries to actually run in QA to get the info you're
after (and it doesn't sounds like you're quite that advanced, no offence
intended). Running
exec sp_who2
in QA will probably tell you what you need to know but there is a
graphic tool in SQL Server Enterprise Manager that will show it to you
in a GUI, which will probably be much more user friendly for a novice.
To start SQLEM (SQL Server Enterprise Manager) run it from the Start
menu (Start | All Programs | Microsoft SQL Server | Enterprise
Manager). Then expand the tree in the left pane to the local server.
Expand the + for the server (it may ask you for login credentials if you
haven't saved them when registering the server in SQLEM). Then expand
Management | Current Activity and click on Process Info. The right pane
will then contain essentially the same info as you'd get from executing
"exec sp_who2", more or less, but in a more user friendly format.
Hope this helps.
*mike hodgson*
http://sqlnerd.blogspot.com
Spin wrote:

>Experts,
>I have a standard SQL 2000 installed onto a Windows 2003 Server on which I
>am a local administrator. An IIS server by way of ASP.NET uses this SQL
>database server as it's back-end. Someone told me there is a way in SQL to
>see who is using the database via the ASP>NET front-end on the IIS server.
>Something called Query Analyzer I believe. How do I get to that in SQL? I
>am such a SQL novice that I'm afraid I'll need the exact steps to click to
>fire this thing up. :-)
>
>
|||You are the MAN!
Spin
"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message
news:%23QZkJwbNGHA.3272@.tk2msftngp13.phx.gbl...
> Query Analyser is a query tool that comes with SQL Server 2000 (as part
> of Microsoft's "client tools"). You run it from the Start menu (Start |
> All Programs | Microsoft SQL Server | Query Analyzer).
> However, just running QA (Query Analyser) probably won't help you as you
> need to know what queries to actually run in QA to get the info you're
> after (and it doesn't sounds like you're quite that advanced, no offence
> intended). Running
> exec sp_who2
> in QA will probably tell you what you need to know but there is a
> graphic tool in SQL Server Enterprise Manager that will show it to you
> in a GUI, which will probably be much more user friendly for a novice.
> To start SQLEM (SQL Server Enterprise Manager) run it from the Start
> menu (Start | All Programs | Microsoft SQL Server | Enterprise
> Manager). Then expand the tree in the left pane to the local server.
> Expand the + for the server (it may ask you for login credentials if you
> haven't saved them when registering the server in SQLEM). Then expand
> Management | Current Activity and click on Process Info. The right pane
> will then contain essentially the same info as you'd get from executing
> "exec sp_who2", more or less, but in a more user friendly format.
> Hope this helps.
> --
> *mike hodgson*
> http://sqlnerd.blogspot.com
>
> Spin wrote:
>

Query Analyzer?

Experts,
I have a standard SQL 2000 installed onto a Windows 2003 Server on which I
am a local administrator. An IIS server by way of ASP.NET uses this SQL
database server as it's back-end. Someone told me there is a way in SQL to
see who is using the database via the ASP>NET front-end on the IIS server.
Something called Query Analyzer I believe. How do I get to that in SQL? I
am such a SQL novice that I'm afraid I'll need the exact steps to click to
fire this thing up. :-)
SpinQuery Analyser is a query tool that comes with SQL Server 2000 (as part
of Microsoft's "client tools"). You run it from the Start menu (Start |
All Programs | Microsoft SQL Server | Query Analyzer).
However, just running QA (Query Analyser) probably won't help you as you
need to know what queries to actually run in QA to get the info you're
after (and it doesn't sounds like you're quite that advanced, no offence
intended). Running
exec sp_who2
in QA will probably tell you what you need to know but there is a
graphic tool in SQL Server Enterprise Manager that will show it to you
in a GUI, which will probably be much more user friendly for a novice.
To start SQLEM (SQL Server Enterprise Manager) run it from the Start
menu (Start | All Programs | Microsoft SQL Server | Enterprise
Manager). Then expand the tree in the left pane to the local server.
Expand the + for the server (it may ask you for login credentials if you
haven't saved them when registering the server in SQLEM). Then expand
Management | Current Activity and click on Process Info. The right pane
will then contain essentially the same info as you'd get from executing
"exec sp_who2", more or less, but in a more user friendly format.
Hope this helps.
*mike hodgson*
http://sqlnerd.blogspot.com
Spin wrote:

>Experts,
>I have a standard SQL 2000 installed onto a Windows 2003 Server on which I
>am a local administrator. An IIS server by way of ASP.NET uses this SQL
>database server as it's back-end. Someone told me there is a way in SQL to
>see who is using the database via the ASP>NET front-end on the IIS server.
>Something called Query Analyzer I believe. How do I get to that in SQL? I
>am such a SQL novice that I'm afraid I'll need the exact steps to click to
>fire this thing up. :-)
>
>|||You are the MAN!
Spin
"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message
news:%23QZkJwbNGHA.3272@.tk2msftngp13.phx.gbl...
> Query Analyser is a query tool that comes with SQL Server 2000 (as part
> of Microsoft's "client tools"). You run it from the Start menu (Start |
> All Programs | Microsoft SQL Server | Query Analyzer).
> However, just running QA (Query Analyser) probably won't help you as you
> need to know what queries to actually run in QA to get the info you're
> after (and it doesn't sounds like you're quite that advanced, no offence
> intended). Running
> exec sp_who2
> in QA will probably tell you what you need to know but there is a
> graphic tool in SQL Server Enterprise Manager that will show it to you
> in a GUI, which will probably be much more user friendly for a novice.
> To start SQLEM (SQL Server Enterprise Manager) run it from the Start
> menu (Start | All Programs | Microsoft SQL Server | Enterprise
> Manager). Then expand the tree in the left pane to the local server.
> Expand the + for the server (it may ask you for login credentials if you
> haven't saved them when registering the server in SQLEM). Then expand
> Management | Current Activity and click on Process Info. The right pane
> will then contain essentially the same info as you'd get from executing
> "exec sp_who2", more or less, but in a more user friendly format.
> Hope this helps.
> --
> *mike hodgson*
> http://sqlnerd.blogspot.com
>
> Spin wrote:
>
>

Query Analyzer?

Experts,
I have a standard SQL 2000 installed onto a Windows 2003 Server on which I
am a local administrator. An IIS server by way of ASP.NET uses this SQL
database server as it's back-end. Someone told me there is a way in SQL to
see who is using the database via the ASP>NET front-end on the IIS server.
Something called Query Analyzer I believe. How do I get to that in SQL? I
am such a SQL novice that I'm afraid I'll need the exact steps to click to
fire this thing up. :-)
--
SpinThis is a multi-part message in MIME format.
--010701060909050109080101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Query Analyser is a query tool that comes with SQL Server 2000 (as part
of Microsoft's "client tools"). You run it from the Start menu (Start |
All Programs | Microsoft SQL Server | Query Analyzer).
However, just running QA (Query Analyser) probably won't help you as you
need to know what queries to actually run in QA to get the info you're
after (and it doesn't sounds like you're quite that advanced, no offence
intended). Running
exec sp_who2
in QA will probably tell you what you need to know but there is a
graphic tool in SQL Server Enterprise Manager that will show it to you
in a GUI, which will probably be much more user friendly for a novice.
To start SQLEM (SQL Server Enterprise Manager) run it from the Start
menu (Start | All Programs | Microsoft SQL Server | Enterprise
Manager). Then expand the tree in the left pane to the local server.
Expand the + for the server (it may ask you for login credentials if you
haven't saved them when registering the server in SQLEM). Then expand
Management | Current Activity and click on Process Info. The right pane
will then contain essentially the same info as you'd get from executing
"exec sp_who2", more or less, but in a more user friendly format.
Hope this helps.
--
*mike hodgson*
http://sqlnerd.blogspot.com
Spin wrote:
>Experts,
>I have a standard SQL 2000 installed onto a Windows 2003 Server on which I
>am a local administrator. An IIS server by way of ASP.NET uses this SQL
>database server as it's back-end. Someone told me there is a way in SQL to
>see who is using the database via the ASP>NET front-end on the IIS server.
>Something called Query Analyzer I believe. How do I get to that in SQL? I
>am such a SQL novice that I'm afraid I'll need the exact steps to click to
>fire this thing up. :-)
>
>
--010701060909050109080101
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Query Analyser is a query tool that comes with SQL Server 2000 (as
part of Microsoft's "client tools"). You run it from the Start menu
(Start | All Programs | Microsoft SQL Server | Query Analyzer).<br>
<br>
However, just running QA (Query Analyser) probably won't help you as
you need to know what queries to actually run in QA to get the info
you're after (and it doesn't sounds like you're quite that advanced, no
offence intended). Running<br>
<br>
exec sp_who2<br>
<br>
in QA will probably tell you what you need to know but there is a
graphic tool in SQL Server Enterprise Manager that will show it to you
in a GUI, which will probably be much more user friendly for a novice.<br>
<br>
To start SQLEM (SQL Server Enterprise Manager) run it from the Start
menu (Start | All Programs | Microsoft SQL Server | Enterprise
Manager). Then expand the tree in the left pane to the local server.
Expand the + for the server (it may ask you for login credentials if
you haven't saved them when registering the server in SQLEM). Then
expand Management | Current Activity and click on Process Info. The
right pane will then contain essentially the same info as you'd get
from executing "exec sp_who2", more or less, but in a more user
friendly format.<br>
<br>
Hope this helps.<br>
</tt>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font></span> <b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"><br>
<font face="Tahoma" size="2"><a href="http://links.10026.com/?link=http://sqlnerd.blogspot.com</a></font></span>">http://sqlnerd.blogspot.com">http://sqlnerd.blogspot.com</a></font></span>
</p>
</div>
<br>
<br>
Spin wrote:
<blockquote cite="mid45sij6F88964U1@.individual.net" type="cite">
<pre wrap="">Experts,
I have a standard SQL 2000 installed onto a Windows 2003 Server on which I
am a local administrator. An IIS server by way of ASP.NET uses this SQL
database server as it's back-end. Someone told me there is a way in SQL to
see who is using the database via the ASP>NET front-end on the IIS server.
Something called Query Analyzer I believe. How do I get to that in SQL? I
am such a SQL novice that I'm afraid I'll need the exact steps to click to
fire this thing up. :-)
</pre>
</blockquote>
</body>
</html>
--010701060909050109080101--|||You are the MAN!
--
Spin
"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message
news:%23QZkJwbNGHA.3272@.tk2msftngp13.phx.gbl...
> Query Analyser is a query tool that comes with SQL Server 2000 (as part
> of Microsoft's "client tools"). You run it from the Start menu (Start |
> All Programs | Microsoft SQL Server | Query Analyzer).
> However, just running QA (Query Analyser) probably won't help you as you
> need to know what queries to actually run in QA to get the info you're
> after (and it doesn't sounds like you're quite that advanced, no offence
> intended). Running
> exec sp_who2
> in QA will probably tell you what you need to know but there is a
> graphic tool in SQL Server Enterprise Manager that will show it to you
> in a GUI, which will probably be much more user friendly for a novice.
> To start SQLEM (SQL Server Enterprise Manager) run it from the Start
> menu (Start | All Programs | Microsoft SQL Server | Enterprise
> Manager). Then expand the tree in the left pane to the local server.
> Expand the + for the server (it may ask you for login credentials if you
> haven't saved them when registering the server in SQLEM). Then expand
> Management | Current Activity and click on Process Info. The right pane
> will then contain essentially the same info as you'd get from executing
> "exec sp_who2", more or less, but in a more user friendly format.
> Hope this helps.
> --
> *mike hodgson*
> http://sqlnerd.blogspot.com
>
> Spin wrote:
>>Experts,
>>I have a standard SQL 2000 installed onto a Windows 2003 Server on which I
>>am a local administrator. An IIS server by way of ASP.NET uses this SQL
>>database server as it's back-end. Someone told me there is a way in SQL
>>to
>>see who is using the database via the ASP>NET front-end on the IIS server.
>>Something called Query Analyzer I believe. How do I get to that in SQL?
>>I
>>am such a SQL novice that I'm afraid I'll need the exact steps to click to
>>fire this thing up. :-)
>>
>