以下是我在.NET 2.0
. 我应该如何使用LINQ来做到这一点.NET 4.0
?
Dim dt As DataTable
Using oDB As OleDbConnection = GetDbConnection()
oDB.Open()
Using oCmd As New OleDbCommand("SELECT * FROM TABLE1 WHERE COLUMN1 = @id", oDB)
oCmd.Parameters.AddWithValue("@id", UserId)
oDB.Open()
dt = New DataTable()
Using da As OleDbDataAdapter = New OleDbDataAdapter(oCmd)
da.Fill(dt)
End Using
End Using
End Using
Msgbox "Surname: " + dt.Rows(0)("Surname")