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;
}
Loading

Suthish NairRank #92 · 22.8K reputationPosted Jun 22, 2011, 10:16 PM EDT
Am not sure, string idDebitor this must be a int datatype in DB Table and you are passing string value.
Can you explain, what you are doing. Any insertion happening before for this select statement?
Pradeep ChandrakerRank #941 · 2.2K reputationPosted Jun 22, 2011, 10:19 PM EDT
Mike JonsonRank #7,584 · 238 reputationPosted Jun 22, 2011, 10:42 PM EDT
I entered manually this number in debitorID: 12321234-1232-1232-2343-343432783562
Pradeep ChandrakerRank #941 · 2.2K reputationPosted Jun 22, 2011, 10:53 PM EDT
idDebitor = Guid.NewGuid().ToString()
Mike JonsonRank #7,584 · 238 reputationPosted Jun 22, 2011, 11:19 PM EDT
Pradeep ChandrakerRank #941 · 2.2K reputationPosted Jun 22, 2011, 11:36 PM EDT
Mike JonsonRank #7,584 · 238 reputationPosted Jun 22, 2011, 11:38 PM EDT
Mike JonsonRank #7,584 · 238 reputationPosted Jun 22, 2011, 11:40 PM EDT
Pradeep ChandrakerRank #941 · 2.2K reputationPosted Jun 22, 2011, 11:46 PM EDT