473,382 Members | 1,204 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,382 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 2869
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: -...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.