0

I have a desktop application, which verifies the finger and prompt the result I am calling that app in wpf, then this all is showing in asp.net

On asp.net user put the finger, results comes to him how is that done?

On asp.net I created a static class & a web service having a two static members which gets 'query' & connection string, these both member set by asp.net i.e

button1_click() {
      string query = "select * from employee where userid='123'";
        string connString = "Data Source=mypc;Initial Catalog=abc;Persist Security Info=True;User ID=re;Password=12345";

    StaticClass.Query = query;
    StaticClass.ConnStr = connString;
}

Value setting in web service

[WebMethod]
public string Query()
{
    string SelectDataQuery = StaticClass.Query;
    return SelectDataQuery;
}

Desktop application subscribed the web-service which gets and give data. All is well, NOW then I hosted the application on IIS, multiple users are using the application now, on the same time, user1 set the query while user2 gets it. I want to make it multi user, so whats the suggestion, should i create static strings dynamically as much as users create requests which uniqueness or any thing else?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
KarachiCoder
  • 87
  • 1
  • 12

2 Answers2

0

You could try to create an instance object holding the query and connection and then pass it along to the query method. this way each user will have their own instance.

something like this

[WebMethod]
public string Query(StaticClass query)
{
    string SelectDataQuery = query.Query;
    return SelectDataQuery ;
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
workabyte
  • 3,496
  • 2
  • 27
  • 35
0

Just use String.Format to place in the current user id.

button1_click() {
    string query = "select * from employee where userid='{0}'";
    string connString = "Data Source=mypc;Initial Catalog=abc;Persist Security Info=True;User ID=re;Password=12345";

    StaticClass.Query = String.Format(query, currentUserId);
    StaticClass.ConnStr = connString;
}
Black Frog
  • 11,595
  • 1
  • 35
  • 66