473,722 Members | 2,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem of two tables while filling DataSet

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.Fil l 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_i d

-----------------------------------------------------
// and my DataSet in the ASP.NET appplication is which is not working
out ....
objDS = new DataSet();
objcmd = new SqlCommand("Sel ectJobAppliedCV Details", objConn);
objcmd.CommandT ype = CommandType.Sto redProcedure;
objcmd.Paramete rs.Add(new SqlParameter("@ job_id",
Request.QuerySt ring["id"]));
objDA = new SqlDataAdapter( objcmd);
objDA.TableMapp ings.Add("CVDet ails1","Applied Jobs");
objDA.Fill(objD S, "CVDetails" );
dgresponsedetai ls.DataSource = objDS.Tables[0].DefaultView;
dgresponsedetai ls.DataBind();
objConn.Close() ;
----------------------------------------------------------

Mar 15 '06 #1
2 1357
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?

--
Netomatix
http://www.netomatix.com
"savvy" <jo******@gmail .com> wrote in message
news:11******** *************@z 34g2000cwc.goog legroups.com...
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.Fil l 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_i d

-----------------------------------------------------
// and my DataSet in the ASP.NET appplication is which is not working
out ....
objDS = new DataSet();
objcmd = new SqlCommand("Sel ectJobAppliedCV Details", objConn);
objcmd.CommandT ype = CommandType.Sto redProcedure;
objcmd.Paramete rs.Add(new SqlParameter("@ job_id",
Request.QuerySt ring["id"]));
objDA = new SqlDataAdapter( objcmd);
objDA.TableMapp ings.Add("CVDet ails1","Applied Jobs");
objDA.Fill(objD S, "CVDetails" );
dgresponsedetai ls.DataSource = objDS.Tables[0].DefaultView;
dgresponsedetai ls.DataBind();
objConn.Close() ;
----------------------------------------------------------

Mar 15 '06 #2
objDA.TableMapp ings.Add("CVDet ails1","Applied Jobs");
objDA.Fill(objD S, "CVDetails" );

Though i've coded as shown above, i'm able to only see either
AppliedJobs details or CVDetails details but not both.
When its returning only one table then what table name should i use to
fill the DataSet . Are the above two lines in the
correct format?
Thanks in Advance

Mar 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2103
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the content of an untyped DataSet. This is to be done in the "DropDown" Event (since the dataset is empty at program start). If I go with this:
3
4507
by: Dan | last post by:
I'm writing a record from an asp.net page to SQL Server. After the insert I'm selecting @@identity to return the ID of the record that I just wrote. It worked fine until I typed a semicolon into one of the string fields to be inserted. The string fields are inside single quotes in the INSERT command. With the semicolon in the string, the record is written correctly including the semicolon, but the identity is not returned. Without a...
3
3288
by: Reney | last post by:
I haven't used the VS Studio's drag&drop method to create my connection, adapters and datasets, but I typed them all. The situation is like this: There is a listbox with members pulled from the database.(I am using an access db). The user selects one value from the listbox and clicks on one of two buttons "ThisWeek" or "LastWeek". The button click events each has its own SQL statement, pulling datarows from two different tables in the...
4
2212
by: Nikolay Petrov | last post by:
I have a Listbox binded to as DataSet. Also I have sub to hadle SelectedIndexChanged event. The problem is that every time the dataset is filled the SelectedIndexChanged is fired. How can I prevent this?
5
1251
by: Richard Fagen | last post by:
Hi Everyone, I have been writing xBase applications for many years but I am new to VB/SQL for larger applications. In xBase, I would start the main program (form) by opening up all the datafiles (dbf) and indexes (cdx) that I would need to reference throughout the application. I would also keep these files open throughout the application.
5
2233
by: aniket_sp | last post by:
i am using a data adapter and a dataset for filling and retrieving data into .mdb database. following is the code..... for the form load event Dim dc(0) As DataColumn Try If OleDbConnection1.State = ConnectionState.Closed Then OleDbConnection1.Open() Else
5
3397
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open left, I always see that there are 2 connections open and in "ESTABLISHED" state. Here is the piece of code that I'm using, please tell where I'm doing it wrong. Since this class is being used at many placed in my actual web based application that...
1
1766
by: Robert Dufour | last post by:
I have a table of addresses and it contains a CountryId which points to a table of countries. The datatstructure of the Countries Lookup tables is actually created from three tables - a CountryIdtable - a Countries localized tables and an cultures tables From which I extract a dataset select CountryID - CountryName - Culture name (with inner joins between the three) where CultureName = CurrentCulture.CurrentUiCulture.tostring. So I would...
0
866
by: Alberto Poblacion | last post by:
"JB" <jamesb457@gmail.comwrote in message news:3c8d65e6-9993-4d46-8a01-a11e89ca745d@e39g2000hsf.googlegroups.com... Something is wrong here. You are filling a DataSet called "dataSet", but you are then databinding with another DataSet named "products".
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.