The given should return A,B that is two rows because both
accountnames A and B have the same user_Id=1 but it is only returning
A when I performed the op. MessageBox.Show("AccountNames:" +
Object.ToString() );
[WebMethod]
public Object GetAccountNames(string User_Id)
{
//string AccountNames;
Object AccountNames;
// create a Command,Connection and Reader object
System.Data.SqlClient.SqlConnection sqlConnection1 =
new System.Data.SqlClient.SqlConnection(connectionStri ng);
System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand();
//Object returnValue;
// Search for the pincode
cmd.CommandText = "SELECT acc_name FROM Account_Information
where user_id='" + User_Id + "'";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
AccountNames = cmd.ExecuteScalar();
//AccountNames = returnValue.ToString();
sqlConnection1.Close();
return AccountNames;
}