Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
i wrote this function to set the member status but its not checking the 3rd and 4th condtion please check and tell me where i go wrong???
 

 

 
private void BindCheck(string code)
{
// SqlConnection con = new SqlConnection("");
SqlConnection con = new SqlConnection("");
 
con.Open();
string query = "SELECT * FROM Registration_Master WHERE regCode= '" + code + "'";
 
com = new SqlCommand(query, con);
com.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(com);
DataTable dt = new DataTable();
da.Fill(dt);
 
try
{
if (dt.Rows.Count > 0)
{
BindCheck(dt.Rows[0]["sponcorid"].ToString());
int count_mem = Convert.ToInt32(dt.Rows[0]["count_mem"]);
count_mem++;
com = new SqlCommand();
com.Connection = con;
com.CommandText = "UPDATE Registration_Master SET count_mem = '" + count_mem + "' ,modifieddate='" + DateTime.Now + "' WHERE regCode = '" + code + "'";
com.CommandType = CommandType.Text;
com.ExecuteNonQuery();
 

if (Convert.ToInt32(dt.Rows[0]["count_mem"]) > 20)
{
query = "UPDATE Registration_Master SET member_status= 'MANAGER' ,modifieddate='" + DateTime.Now + "' WHERE regCode= '" + code + "'";
com = new SqlCommand(query, con);
com.CommandType = CommandType.Text;
com.ExecuteNonQuery();
}
else if (Convert.ToInt32(dt.Rows[0]["count_mem"]) > 40)
{
query = "UPDATE Registration_Master SET member_status= 'CHIEF MANAGER' ,modifieddate='" + DateTime.Now + "' WHERE regCode= '" + code + "'";
com = new SqlCommand(query, con);
com.CommandType = CommandType.Text;
com.ExecuteNonQuery();
}
 
else if (Convert.ToInt32(dt.Rows[0]["count_mem"]) > 60)
{
query = "UPDATE Registration_Master SET member_status= 'DIRECTOR' ,modifieddate='" + DateTime.Now + "' WHERE regCode= '" + code + "'";
com = new SqlCommand(query, con);
com.CommandType = CommandType.Text;
com.ExecuteNonQuery();
}
 

 
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
}
}
Posted 5-Nov-12 18:00pm
Edited 5-Nov-12 23:52pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi
 
If (x >20 && x<=40)
{
Some Statements
}
 
IF (x>40 && x<=60)
{
Some Statements
}
 
try this....!!!!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Guruprasad.K.Basavaraju 450
1 Sergey Alexandrovich Kryukov 370
2 Shai Vashdi 318
3 OriginalGriff 265
4 Peter Leow 171
0 Sergey Alexandrovich Kryukov 9,109
1 OriginalGriff 5,290
2 Peter Leow 4,010
3 Maciej Los 3,535
4 Abhinav S 3,263


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 6 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid