How to Make an bitwise OR operation

Posted by Self-Innovator under ASP.NET on 4/2/2012 | Points: 10 | Views : 1497 | Status : [Member] | Replies : 5
Hi,,,
pls tel me i've a string of array i wanted to make an bitwise OR Operation so how can i acheieve it...
here my Vode go through and find soln..
 if (ds.Tables[0].Rows.Count >0)
{
if(Pwd==ds.Tables[0].Rows[0]["Password"].ToString());
//Count="Select Count(UserId) from tblUserGrpMap Where UserId='"+txtUser.Text.Trim()+"'";
string getQuery = "Select U.UserID,Grp.PrivilegeID From tblUserGrpMap U Left Outer Join tblGroupPrivMst Grp On U.GroupCode=Grp.GroupCode Where U.UserId= '" + txtUser.Text.Trim() + "'";
SqlCommand cmd2 = new SqlCommand(getQuery, cnn);
cnn.Open();
cmd.ExecuteNonQuery();
SqlDataAdapter ada2 = new SqlDataAdapter(cmd2);
DataSet ds2 = new DataSet();
ada2.Fill(ds2);
if (ds2.Tables[0].Rows.Count > 0)
{
int i = 0;
string[] arr1 = new string[10];
while (i < ds2.Tables[0].Rows.Count)
{
arr1[i] = ds2.Tables[0].Rows[i]["PrivilegeID"].ToString();
i++;
}
i = 0;
while (i < arr1.Length)
{
arr1[i] = arr1[i] | arr1[i + 1];
i++;
}

}

I got erreo

Cannot applied opearnds | to string to string

Join Hands Change lives
Thanks & Regards
Straight Edge Society



Responses

Posted by: Naraayanan on: 4/9/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Please mentioned error line in bold

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 4/10/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

I think you have make mistake
Bitwise operator is used by || not single character |.

For more details Please give line number or fetails in which line you got error

R D Patel

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 4/10/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

this may help you

http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/c03bb698-5440-416b-85ea-703762b6ccec

R D Patel

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/11/2012 [Member] Silver | Points: 25

Up
0
Down
Hi,

the link is Bitwise '&' operation example...

follow this and make OR operation...

http://subbusspace.blogspot.in/search/label/Bitwise%20computing%20C%23

Regards,
Singaravel M

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 4/11/2012 [Member] Bronze | Points: 25

Up
0
Down
hi

http://www.dotnetperls.com/and

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response