在SQL数据库解决Me.Products

编程入门 行业动态 更新时间:2024-10-20 03:32:12
本文介绍了在SQL数据库解决Me.Products的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何处理 Me.Products 的?我使用Northwind.mdf数据库表中的产品。该表是药到DBML文件。

Me.Products 的需要与陈述或文件,使其可用来定义。也许朦胧的说法是不正确的?

部分公共类NorthwindDataContext    昏暗的产品为对象    公共职能GetProductsByCategory(BYVAL ID1作为整数)为IEnumerable(以产品)        返回从p在Me.Products _               凡p.ProductID = ID1 _               选择p    结束功能末级

解决方案

我在VB中非常薄弱,但仍然尝试是暗淡用于创建变量。首先创建northwinddatacontext为如的对象。

昏暗的分贝作为新northwinddatacontext()

那么你可以得到表作为

VAR的查询=从p在db.Products            其中,p.ProductID = ID            的选择p

How do I handle Me.Products? I am using Northwind.mdf database in table "Products". The table was drug onto a dbml file.

Me.Products needs to be defined with a statement or a file to make it usable. Maybe the dim statement is incorrect?

Partial Public Class NorthwindDataContext Dim Products As Object Public Function GetProductsByCategory(ByVal id1 As Integer) As IEnumerable(Of Product) Return From p In Me.Products _ Where p.ProductID = id1 _ Select p End Function End Class

解决方案

I am very weak in VB but still try it yes dim is used to create variables. First create an object of northwinddatacontext for eg.

dim db as new northwinddatacontext()

then you can get the table as

var query = from p in db.Products where p.ProductID = id select p

更多推荐

在SQL数据库解决Me.Products

本文发布于:2023-10-30 04:21:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541750.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库   SQL   Products

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!