c# - Parameters supplied for object which is not a function. If the parameters are intended as a table hint, a WITH keyword is required -
i'm running windows 7 , ii7 , sql server 2008 r2 . have aspx program , when try run following error
parameters supplied object 'users' not function. if parameters intended table hint, keyword required.
what i've coded :
public arraylist getgoodslist(string type, string goodstype, string user, string paytype, bool flag) { conn = new sqlconnection(system.configuration.configurationmanager.appsettings["conn"].tostring()); dataset ds = new dataset(); ssql = "select count(*) users('" + type + "','" + goodstype + "','" + user + "','" + paytype + "')"; if (flag == true) { ssql += "where iscommend = 1"; } sqlcommand cmd = new sqlcommand(); cmd.connection = conn; cmd.commandtext = ssql; conn.open(); int maxrow = int32.parse(cmd.executescalar().tostring()); ssql = "select * users('" + type + "','" + goodstype + "','" + user + "','" + paytype + "')"; if (flag == true) { ssql += "where iscommend = 1"; } cmd.commandtext = ssql; sqldatareader reader = cmd.executereader(); arraylist ginfos = new arraylist(); goodsinfo ginfo; (int = 0; < maxrow; i++) { if (reader.read()) { ginfo = new goodsinfo(); ginfo.g_id = int32.parse(reader["g_id"].tostring()); ginfo.g_name = reader["g_name"].tostring(); ginfo.type = reader["type"].tostring(); ginfo.goodstype = reader["goodstype"].tostring(); ginfos.add(ginfo); } } conn.close(); return ginfos; }
any idea? thanks!
without giving away answer, issue in in select
statement, ssql = ...
it's not correct sql syntax.
have read of this wikipedia article on select
statement.
Comments
Post a Comment