473,698 Members | 1,780 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 1356
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
2101
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
4505
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
3286
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
1250
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
2232
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
3389
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
1764
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
865
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
8672
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
8600
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
9156
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
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4361
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2323
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.