这里是初级程序员,我一直被这个问题困扰,即通过 Microsoft Visual Studio 查询我的数据库(SQL Server)并实际返回我想要的结果的元组。
例如..如果我想要特定项目 ID 的扇区,我会在子程序中像这样查询它,然后调用子程序
Public Sub testing()
projectID = 1
Dim sqlQueryObject = (From a In db.Project1 Where a.ProjectID = projectID
Select a.Sector) 'Using LINQ
'Now have the object (works fine)
'The Issue is getting the actual sector value from this query...in which I've tried a couple of things
End Sub
dim somestring as string = Cstr(sqlQueryObject)
dim somestring as string = Ctype(sqlqueryobject, string)
两者都不起作用,如果projectID
1 的扇区被命名Zero
- 我如何对其进行编程以返回此值?