in vb use would use : connection class for establishing connection, recordset class for intereacting with database.
in vb.net : connection part remains same , but new set of classes introduced to interact with the database is DATAADAPTER, DATASET etc.. here we not have recordset. instead we use adapter and dataset
because vb.net is more polular for disconnected architecture. we achive disconnected architect with the help of dataset classes (vb was polular for connected)How database connectivity in coding in vb .NET is different from vb ?
Not much difference
here is the code if you are using SQl SERVER
Dim conn As New SqlClient.SqlConnection(';Server=(PROG11)鈥?uid = sa; pwd= mdoffice2002; DataBase=mdoffice;'; %26amp; ';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
No comments:
Post a Comment