m_tavakoli
07-31-2010, 08:11 AM
hi,all
my code is in c# as below , the error message is "Syntax error (comma) in query expression 'period=0,cluster=0' " at runtime and apears on line *** .
void find_record(int num, int clu)
{
conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\supply_chain.accdb";
con = new OleDbConnection(conStr);
con.Open();
strsql = "SELECT ID,price,capacity FROM suppliers WHERE period=" + num.ToString() + ",cluster=" + clu.ToString();
OleDbCommand cmd = new OleDbCommand(strsql, con);
*** OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Suppliers.Add(reader["price"].ToString());
help.Add(reader["ID"].ToString());
help2.Add(reader["capacity"].ToString());
}
reader.Close();
con.Close();
}
thanks a lot.
my code is in c# as below , the error message is "Syntax error (comma) in query expression 'period=0,cluster=0' " at runtime and apears on line *** .
void find_record(int num, int clu)
{
conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\supply_chain.accdb";
con = new OleDbConnection(conStr);
con.Open();
strsql = "SELECT ID,price,capacity FROM suppliers WHERE period=" + num.ToString() + ",cluster=" + clu.ToString();
OleDbCommand cmd = new OleDbCommand(strsql, con);
*** OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Suppliers.Add(reader["price"].ToString());
help.Add(reader["ID"].ToString());
help2.Add(reader["capacity"].ToString());
}
reader.Close();
con.Close();
}
thanks a lot.