Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Text
Imports System.Windows.Forms
Imports System.Data.SqlClient
Public Class DIR
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub DIR_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New SqlClient.SqlConnection("Server=(PROG11); uid = sa; pwd= mdoffice2002; DataBase=mdoffice;" & "Integrated Security=SSPI")
Dim rdrQuery As String = "SELECT * FROM C4DIR"
Try
conn.Open()
Dim cmd As New SqlClient.SqlCommand(rdrQuery, conn)
Dim rdr As SqlClient.SqlDataReader = cmd.ExecuteReader()
While rdr.Read()
PatientLN.Text() = rdr("SECAPI1LASTNAME").ToString()
End While
Catch ex As Exception
MessageBox.Show(ex.ToString)
Finally
conn.Close()
End Try
End Sub
Public Overloads Sub Dispose()
MyBase.Dispose()
components.Dispose()
End Sub
End Class
DB connection for vb.net formPlz help me for Sql server 2005 connection to vb.net form
Page 1 of 1
2 Replies - 12966 Views - Last Post: 23 December 2008 - 02:41 PM
#1
DB connection for vb.net form
Posted 22 December 2008 - 07:44 AM
Replies To: DB connection for vb.net form
#2
Re: DB connection for vb.net form
Posted 23 December 2008 - 02:21 PM
i'd like to help you but you really aren't providing a lot of details as to what problem you are having.
#3
Re: DB connection for vb.net form
Posted 23 December 2008 - 02:41 PM
Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:
- Post the code you're having problems with (DONE)
- Post the exact error you're receiving, if you are receiving one
- If no error explain what the code is doing versus what you want it to do
- Post your question in the body of your post, not the description field
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|