I am trying to add a parameter to sqlDataAdapter. I tried using parameters.add (), but the adapter is not sqlCommand. Here is my code.
Private Sub convertToCSV(ByVal SqlQuery As String) Dim Dt As New DataTable() Dim SqlCon As New SqlConnection("Data Source=db;Initial Catalog=productionservicereminder;User Id=id;Password=pass;") Dim Ada As New SqlDataAdapter(SqlQuery, SqlCon) Ada.Fill(Dt) Public Sub excSP(ByVal ReprtID As Integer, ByVal pgid As Integer) convertToCSV(sql4) End Sub
Basically I am trying to do something like this:
Ada.Parameters.Add(New SqlParameter("@pgid", pgid))
source share