运算符> <在 sql c# asp.net 上

发布于 2024-11-11 05:24:09 字数 881 浏览 5 评论 0 原文

我有 page.aspx ,我有标签显示打开拍卖的最小数字(来自项目表,sql)...示例 - 最小数字值为 5...在我得到 5 个出价后(来自表:购买) - 拍卖开始并在其他标签处显示图片:V。而购买数量小于 5 - 我想显示 X 图像。

我有两个表:

项目(id,minNumber)

购买(id)

当用户购买某物时,id值增加一..(例如:如果我买了香蕉,那么我得到了id一..之后我买了球 - 我得到了id 2.)

问题:

我如何使用运算符 > < = 在代码后面使用 sql 表....

我对 sql 很陌生。我通常使用 LINQ to SQL.. 或 sql cmnd at code Behind.LINQ like:

using (DataClassesDataContext myDataContext = new DataClassesDataContext())
{
  var bla = from items in myDataContext.items 
         ..................
    }

但如何继续?

我已经尝试过:

               var Tokef =
                from items in myDataContext.items
                from purchase in myDataContext.purchases
                if (items.Minbuy == purchase.purchaseid) {
                   Image2.Visible = true; }

但它不起作用!

I have page.aspx , i have label that shown what is the minimum number (from item table, sql) to open an auoction ...example - the minimum number value is 5... after i got 5 bids (from table: purchase) - the auoction start and at other lablel shown img: V. while the number of purchase small then 5 - i want to show X image.

i have two tables:

items (id, minNumber)

purchase (id)

when user buy somthing the id value up by one..(example: if i bought banana so i got the id one..after that i buy ball - i got the id 2.)

the question:

how can i use the operators > < = at code behind with the use of sql tables....

i'm very new at sql. i'm usually use LINQ to SQL.. or sql cmnd at code behind.LINQ like:

using (DataClassesDataContext myDataContext = new DataClassesDataContext())
{
  var bla = from items in myDataContext.items 
         ..................
    }

but how to continue?

i'v been tried:

               var Tokef =
                from items in myDataContext.items
                from purchase in myDataContext.purchases
                if (items.Minbuy == purchase.purchaseid) {
                   Image2.Visible = true; }

but it doesnt work !!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没企图 2024-11-18 05:24:09

尝试类似

 string sql = "Select * From items Where id LIKE '" + ID + "' AND minNumber <>= '" + minNumber+ "'";

Linq to SQL 的 方法
尝试如下:var items = from p in db.items where p.ID == "someValue" AND p.minNumber <>= "somevalue" select p;

try something like

 string sql = "Select * From items Where id LIKE '" + ID + "' AND minNumber <>= '" + minNumber+ "'";

for Linq to SQL
try something like:var items = from p in db.items where p.ID == "someValue" AND p.minNumber <>= "somevalue" select p;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文