我必須使用「@」(我不知道它的名字)。我可以用它更新刪除或插入語句,但我不能在那裏使用它,它提供了URL必須聲明我怎樣才能把@放在select sql語句中?
//SQL string to count the amount of rows within the OSDE_Users table
string sql = "SELECT * FROM RSSFeeds where URL = @URL";
SqlCommand cmd = new SqlCommand(sql, Connect());
cmd.Parameters.Add("@URL", SqlDbType.VarChar, 500).Value = url;
closeConnection();
SqlDataAdapter adapt = new SqlDataAdapter(sql, Connect());
DataSet ds = new DataSet();
adapt.Fill(ds);
// result of query filled into datasource
adapt.Dispose();
closeConnection();
return ds;
什麼錯誤 – 2012-04-08 20:06:52
是'URL'的'INT'?我感覺它不是。 – Ryan 2012-04-08 20:06:57
@minitech很好。 – 2012-04-08 20:07:39