473,394 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

scope of static property

I'm supporting an asp dotnet application. There is a static property
in the code as below. Can anyone tell me in multiuser enviornment,
this propery will return a different dataset each time it is accessed
by different users?

public static DataSet GetRatings(string ratingString)
{
// Create a new dataset
DataSet dsReturn = new DataSet();

// Open a connection
SqlConnection _connection = new
SqlConnection(GlobalConstant.DBConnection);
_connection.Open();

// Create an adapter and populate the dataset
SqlDataAdapter sqlAdapter = new
SqlDataAdapter("spGetRatingDropdown", _connection);
sqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
sqlAdapter.SelectCommand.Parameters.Add("@sRatingC ode",
ratingString);
sqlAdapter.Fill(dsReturn,"SearchResult");
sqlAdapter.Dispose();

_connection.Close();

return dsReturn;

}
Nov 16 '05 #1
1 2871
Hi,

Yes, each caller will get a new instance of the dataset. However, if your
dataset property was a static member, then each caller would get the same
instance of the dataset.

Regards,
Luke Venediger
http://blogdotnet.blogspot.net

"Amit" <am**********@rediffmail.com> wrote in message
news:ae**************************@posting.google.c om...
I'm supporting an asp dotnet application. There is a static property
in the code as below. Can anyone tell me in multiuser enviornment,
this propery will return a different dataset each time it is accessed
by different users?

public static DataSet GetRatings(string ratingString)
{
// Create a new dataset
DataSet dsReturn = new DataSet();

// Open a connection
SqlConnection _connection = new
SqlConnection(GlobalConstant.DBConnection);
_connection.Open();

// Create an adapter and populate the dataset
SqlDataAdapter sqlAdapter = new
SqlDataAdapter("spGetRatingDropdown", _connection);
sqlAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
sqlAdapter.SelectCommand.Parameters.Add("@sRatingC ode",
ratingString);
sqlAdapter.Fill(dsReturn,"SearchResult");
sqlAdapter.Dispose();

_connection.Close();

return dsReturn;

}

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pembed2003 | last post by:
Hi all, I am reading the book "C How to Program" and in the chapter where it discuss scope rule, it says there are four scopes for a variable: function scope file scope block scope...
10
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
7
by: Christian Christmann | last post by:
Hi, I've a a question on the specifier extern. Code example: void func( void ) { extern int e; //...
26
by: Patient Guy | last post by:
The code below shows the familiar way of restricting a function to be a method of a constructed object: function aConstructor(arg) { if (typeof(arg) == "undefined") return (null);...
1
by: Giacomo Catenazzi | last post by:
Hello, To learn the details of C, I've build the following example, could you check if it is correct and if it miss some important cases? Are there some useful (real cases) examples of: -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.