?
Solved

VB.Net 2005 How to get a Table Adapter to display a certain record based on a parameter passed in ??

Posted on 2010-09-20
3
Medium Priority
?
596 Views
Last Modified: 2012-05-10
I am using VB.Net 2005..

I have on the Load Event of the form... a Table adapter that shows all the records of the tCust table

       Me.TCustTableAdapter.Fill(Me.RecycleDataSet1.tCust)
        Dim sql As String
        Dim da1 As SqlClient.SqlDataAdapter
        Dim ds1 As DataSet = New DataSet

There are about  1000 records that are being returned.. the "ID" field of the Customer table is tCust.lID...if I wanted to get the table adapter to load based on a ID passed into it ..

For example instead of seeing all the records.. I want to see..tCust.lId = 150

What would the code look like?

Any insight would be greatly appreciated...
0
Comment
Question by:nomar2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
John (Yiannis) Toutountzoglou earned 444 total points
ID: 33719430
there ways you can do that ...
Or By using The BindingSource.Filter
Or Create a query in your dataset Designer ...you can insert there a Where Clause :    WHERE ID=@ID
then your TableAdapter Excpets a parameter..
 Me.TCustTableAdapter.FillByID(Me.RecycleDataSet1.tCust,Me.TextBox1.Text)    > (For Example)
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33719472
Excpets=Excpects  
0
 

Author Comment

by:nomar2
ID: 33734565
 I sed the      
I used BindingSource.Filter Based on your suggestion..here is the sample code

Me.TCustTableAdapter.Fill(Me.RecycleDataSet1.tCust)
        Dim lnTestid As Integer
        lnTestid = 1000
        Me.TCustBindingSource.Filter = "lID=" & lnTestid & ""
        Dim sql As String
        Dim da1 As SqlClient.SqlDataAdapter
        Dim ds1 As DataSet = New DataSet
        con.Open()
        sql = "SELECT iID,sCustPayType from tCustPayType"
        da1 = New SqlDataAdapter(sql, con)
        da1.Fill(ds1, "tCustPayType")
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question