how to establish database connection with ms sql server in window application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nikhil21
    New Member
    • Apr 2008
    • 1

    how to establish database connection with ms sql server in window application

    database connection with ms sql server in window application by using vb.net
  • sonia.sardana
    New Member
    • Jul 2006
    • 95

    #2
    Example of Gridview DataBinding with the database
    Imports System.Data.Sql Client
    Public Class Form1
    Dim con As New SqlConnection(" Data Source=ABC-17372608800\SQL EXPRESS;Databas e=sonia;integra ted Security=true")
    Dim da As SqlDataAdapter
    Dim ds As New DataSet

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    da = New SqlDataAdapter( "select * from student", con)
    da.Fill(ds, "student")
    DataGridView1.D ataSource = ds.Tables("stud ent")
    End Sub
    End Class

    Comment

    • Shashi Sadasivan
      Recognized Expert Top Contributor
      • Aug 2007
      • 1435

      #3
      It is no different to connecting the database with Asp .Net applications

      For how to create a connection string please refer to connectionstrin g.com
      Last edited by r035198x; Apr 2 '08, 06:48 AM. Reason: changed .org to .com

      Comment

      Working...