How to pull the data out from two table and bind to repeater

Discussion in 'ASP .Net Datagrid Control' started by Elton Wang, Mar 28, 2005.

  1. Elton Wang

    Elton Wang Guest

    Change your sql query to

    SELECT Job.JobID, Application.DateApplied, Job.JobTitle
    FROM Job JOIN Application ON Job.JobID = Application.JobID
    WHERE Application.jobseekerID = @jobSeekerID

    HTH

    Elton Wang


    >-----Original Message-----
    >HI All,
    >
    >Can somebody help what's wrong with my SQL Query

    statement when i want to
    >create a join table query. It suppose work perfectly

    fine, but why it cant
    >work. The error that the ASP.Net throw out is "Object

    reference not set to
    >an instance of an object. "

    and "System.NullReferenceException: Object
    >reference not set to an instance of an object." at the

    line
    >dtrViewApplication.Close()
    >
    >I have two table which are Job (JobID, JobTitle) and

    Application(JobID,
    >DateApplied, jobseekerID). I want both table field to be

    joined and display
    >by using Repeater.
    >
    >Pls refer to the below for the source code.
    >
    >Dim jobProvider As OleDbConnection
    >
    >Dim cmdSelect As OleDbCommand
    >
    >Dim dtrViewApplication As OleDbDataReader
    >
    >Dim strSelect As String
    >
    > jobProvider = New OleDbConnection
    >("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA

    Source=C:\Inetpub\wwwroot\JobSeeker\
    >JobProvider.mdb")
    >
    > strSelect = "select JobID, DateApplied, Job.JobTitle

    from
    >Application, Job where Application.JobID = Job.JobID

    And " & _
    >
    > " jobSeekerID=@jobSeekerID"
    >
    >
    >
    > cmdSelect = New OleDbCommand(strSelect, jobProvider)
    >
    > cmdSelect.Parameters.Add("@LoginName", "JS12345")
    >
    >Try
    >
    > jobProvider.Open()
    >
    > dtrViewApplication = cmdSelect.ExecuteReader
    >
    > rptApplication.DataSource = dtrViewApplication
    >
    > rptApplication.DataBind()
    >
    >Catch ex As Exception
    >
    > Label1.Text = ex.Message & vbCrLf & ex.Source &

    vbCrLf &
    >ex.StackTrace & vbCrLf & ex.TargetSite.Name
    >
    >Finally
    >
    > dtrViewApplication.Close()
    >
    > jobProvider.Close()
    >
    >End Try
    >
    >Thanks in advance
    >
    >--
    >Message posted via http://www.dotnetmonster.com
    >.
    >
     
    Elton Wang, Mar 28, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Lozzi
    Replies:
    1
    Views:
    453
    Lucas Tam
    Aug 9, 2004
  2. mr2_93
    Replies:
    1
    Views:
    3,677
    mr2_93
    Oct 2, 2005
  3. Replies:
    2
    Views:
    2,228
    Mike Treseler
    Jun 28, 2006
  4. PerlFAQ Server
    Replies:
    0
    Views:
    180
    PerlFAQ Server
    Jan 14, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    168
    PerlFAQ Server
    Apr 19, 2011
Loading...

Share This Page