Problem of two tables while filling DataSet

S

savvy

I'm trying to page a datagrid but the when i'm tying to fill the
DataSet with a table, I know that using DataAdapter.Fill you can
specify a single datatable to populate when the sp returns one table.
How do I fill my dataset when the sp is a combination of two tables.
i'm not able to understand how to fill it when i'm using a sql server
stored procedure as given below
any suggestions will be greatly appreciated.
Thanks for your help and time in Advance

-----------------------------------------------------
SELECT AJ.*, CD.* FROM AppliedJobs AS AJ, CVDetails AS CD WHERE
AJ.JS_ID = CD.JS_ID AND AJ.CV_ID= CD.CV_ID AND AJ.JobID=@job_id

-----------------------------------------------------
// and my DataSet in the ASP.NET appplication is which is not working
out ....
objDS = new DataSet();
objcmd = new SqlCommand("SelectJobAppliedCVDetails", objConn);
objcmd.CommandType = CommandType.StoredProcedure;
objcmd.Parameters.Add(new SqlParameter("@job_id",
Request.QueryString["id"]));
objDA = new SqlDataAdapter(objcmd);
objDA.TableMappings.Add("CVDetails1","AppliedJobs");
objDA.Fill(objDS, "CVDetails");
dgresponsedetails.DataSource = objDS.Tables[0].DefaultView;
dgresponsedetails.DataBind();
objConn.Close();
----------------------------------------------------------
 
W

Winista

Your SP Is doing a simple join on 2 tables. It is going to return one table
only.

What do you mean "not working"? What is happening and what are you
expecting?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top