How To Pass A Parameter To A TableAdapter - VB 2019

  • Thread starter Thread starter Developer Dude
  • Start date Start date
D

Developer Dude

Guest
Hi:

I have a simple TableAdapter query to fill a dataset. The query has a parameter "Param1". I cannot

figure out how to pass a value from a "Form" into "Param1". I am using an MSAcess databse and oledb.

I have spent the last two days researching but nothing works so far.

Here is the query:

SELECT SE_KEY, SE_NAME, SE_ST, SE_JT, SE_CTRY, SE_TIER3, SE_TIER3_T, SE_TIER2, SE_TIER2_T, SE_TIER1, SE_TIER1_T, SE_URL, SE_AM, SE_AP, SE_AT, SE_CS, SE_FTC, SE_FRC, SE_CG, SE_CD, SE_CC, SE_CO, SE_EQ, SE_FA, SE_GA, SE_OR1, SE_OR2, SE_OR3, SE_OR4, SE_OR5, SE_OR6, SE_RA, SE_SH, SE_TA, SE_TG, SE_TE, SE_VE, SE_E_DATE, SE_R_DATE FROM SE WHERE TIER3 = ?

Here is the code in my form:


Option Explicit On
Option Strict On

Imports System.Data
Imports System.Reflection
Imports System.Data.OleDb

Public Class FrmRpt_SE_2

Private Sub FrmRpt_SE_2_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim ds As New PSBDataSet
Dim ad As New PSBDataSetTableAdapters.SETableAdapter

Dim param As OleDbParameter = New OleDbParameter With {
.ParameterName = "Param1",
.OleDbType = OleDbType.VarChar,
.Direction = ParameterDirection.Input,
.Value = "?"}

ad.oledparameters.Add(param)



ad.GetDataByTier3(ds.SE)

Dim rpt As New CrystalReport_SE_1
rpt.SetDataSource(ds)
CrystalReportViewer1.ReportSource = rpt

End Sub

End Class


I would really appreciate some help. Thanks.

Continue reading...
 
Back
Top