|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to pull the data out from two table and bind to repeaterCan 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 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 elton_w***@hotmail.com >-----Original Message----- statement when i want to>HI All, > >Can somebody help what's wrong with my SQL Query >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 joined and displayline >dtrViewApplication.Close() > >I have two table which are Job (JobID, JobTitle) and Application(JobID, >DateApplied, jobseekerID). I want both table field to be >by using Repeater. Source=C:\Inetpub\wwwroot\JobSeeker\> >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 >JobProvider.mdb") And " & _> > strSelect = "select JobID, DateApplied, Job.JobTitle from >Application, Job where Application.JobID = Job.JobID Show quoteHide quote > > " 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 >. >
How can I display hashtable key values in a web page?
Move bound column to right of dynamic column in datagrid? Add text from listbox into datagrid column To Eliyahu Print WebForm DataGrid Dynamically Add Validation to Datagrid Add row to datagrid? problem exporting datagrid to excel User Control ASP .Net Message box help Needed Very urgent |
|||||||||||||||||||||||