G
Guest
I am simple tryint to learn how to use the ADO.NET code. Can anybody tell me
if I am using it right or not?
Imports System.Data.sqlclient
Imports System.Data
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim conn As New SqlConnection("Server=apw-db;" & _
"DataBase=APW-System; Integrated Security=SSPI")
Dim sqlstr As String = "SELECT * FROM sysName"
Dim da As SqlDataAdapter
Dim ds As New DataSet
da = New SqlDataAdapter(sqlstr, conn)
da.Fill(ds)
Dim dt As DataTable = ds.Tables(0)
MsgBox(dt.Rows.Item("sysName")) 'trying to show what is in field
End Sub
End Class
if I am using it right or not?
Imports System.Data.sqlclient
Imports System.Data
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim conn As New SqlConnection("Server=apw-db;" & _
"DataBase=APW-System; Integrated Security=SSPI")
Dim sqlstr As String = "SELECT * FROM sysName"
Dim da As SqlDataAdapter
Dim ds As New DataSet
da = New SqlDataAdapter(sqlstr, conn)
da.Fill(ds)
Dim dt As DataTable = ds.Tables(0)
MsgBox(dt.Rows.Item("sysName")) 'trying to show what is in field
End Sub
End Class