9
Reply

Operand type clash: uniqueidentifier is incompatible with numeric

Mike Jonson

Mike Jonson

Jun 23 2011 2:01 AM
10.3k
I have create next Method and every time error: Operand type clash: uniqueidentifier is incompatible with numeric. I vant undestand why. Please help.

public object GetCredits(string idDebitor)
        {
            ArrayList allCredits = new ArrayList();

            using (SqlConnection con = new SqlConnection(conectionString)) //???????????? ? ??
            {
                string query = string.Format("select * from Credits where DebitorID={0}", idDebitor);
                SqlCommand com = new SqlCommand(query, con); //??????? ???????? ???????
                //try
                {
                    con.Open(); //????????? ??????????

                    SqlDataReader dr = com.ExecuteReader(); //????????? ?????? ?? ??????? ? ?????????? dr
                    if (dr.HasRows) //???? ??????? ?? ??????, ????????? ? ??????
                        foreach (DbDataRecord result in dr)
                            allCredits.Add(result);
                }
                //catch
                { }
            }
            return allCredits;
        }




Answers (9)