ADO.NET Code executing stored procedure

ADO.NET Code executing stored procedure.

Code showing how to fetch data using Stored Procedure.
Imports System
Imports System.Data
Imports System.Data.SqlClient

Private Function FillForm()
      Dim myConn As New SqlConnection()
      Dim Parm As New SqlParameter()
      Dim dr As SqlDataReader
      myConn.ConnectionString = "data source=(local);initial catalog=Jobs;integrated security _
       =SSPI;persist security info=False;workstation id=XYZ;packet size=4096"
      myConn.Open()
      Dim cmd As SqlCommand = New SqlCommand("Select_Employer", myConn)
      cmd.CommandType = CommandType.StoredProcedure
      Parm = cmd.Parameters.Add("@EmployerId", SqlDbType.Int, 9)
      Parm.Value = 1
      dr = cmd.ExecuteReader()
      If (dr.Read = True) Then
            txtName.Text = dr("UserName")
      end if
      dr.Close()
      dr = Nothing
      cmd.Connection.Close()
      myConn.Close()
End Function
ADO.NET transaction Processing
ADO.NET transaction Processing - The transaction object handles concurrency issue using IsolationLevel settings. The settings can be....
Explain the namespaces in which .NET has the data functionality class.
System.data contains basic objects. These objects are used for accessing and storing relational data....
Use of data adapter
The data adapter objects connect a command objects to a Dataset object....
Post your comment