我们如何使用 VB 作为语言从 ASP.NET 数据库中检索数据?

发布于 2024-08-06 14:01:14 字数 92 浏览 5 评论 0原文

我需要从数据库检索数据的完整代码。我在 Visual Web Developer 中进行编码并使用 VB 作为编码语言。我使用 SQL SERVER 作为数据库处理程序。

i need the complete code for retreiving the data from a database.. i m coding in visual web developer and using VB as coding language. I m using SQL SERVER as database handler.

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

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

发布评论

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

评论(2

寂寞清仓 2024-08-13 14:01:14
 Shared Dim con As SqlConnection

Shared Sub Main()
    con = New SqlConnection("Server=(local)\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI") 

    ' Create the command object
    Dim str As String = "SELECT ID, FirstName, LastName FROM Employee"
    Dim cmd As New SqlCommand(str, con)

    Dim da As New SqlDataAdapter(cmd)

    Dim ds As New DataSet()

    da.Fill(ds, "Employee")

    gridview1.datasource=ds;//
     gridview1.databind();// to bind the data to gridview

它会对你有帮助..

 Shared Dim con As SqlConnection

Shared Sub Main()
    con = New SqlConnection("Server=(local)\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI") 

    ' Create the command object
    Dim str As String = "SELECT ID, FirstName, LastName FROM Employee"
    Dim cmd As New SqlCommand(str, con)

    Dim da As New SqlDataAdapter(cmd)

    Dim ds As New DataSet()

    da.Fill(ds, "Employee")

    gridview1.datasource=ds;//
     gridview1.databind();// to bind the data to gridview

its will be help to u..

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