ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  ASP.NET
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
How to merge 2 tables fields in DataTable in asp.net
 Question Submitted By :: Jsureshdotnet
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to merge 2 tables fields in DataTable in asp.net
Answer
# 1
you can use the query to merge the fields.that query will 
be executed through the sqlcommand.
 
Is This Answer Correct ?    6 Yes 1 No
Senthil Kumar
 
  Re: How to merge 2 tables fields in DataTable in asp.net
Answer
# 2
You Can Write Query :

select (databasename).(owner).(tablename1).
(datafield),select (databasename).(owner).(tablename2).
(datafield) from (databasename).(owner).(tablename1),
(databasename).(owner).(tablename2)


Example:select 
LSKGROUP.dbo.addsites.state,LSKGROUP.dbo.employee.empname 
from LSKGROUP.dbo.addsites,LSKGROUP.dbo.employee

and then fill the values to new dataset table.

Remember:

if database also differ put databse's name accordingly




Good Luck.....
 
Is This Answer Correct ?    5 Yes 1 No
Prakash
 
 
 
  Re: How to merge 2 tables fields in DataTable in asp.net
Answer
# 3
Consider a dataset(ds) having two datatables or we can say
that it contains data from two tables..

System.Data.DataTable dt = new DataTable();
dt.Columns.Add("Field1", typeof(string));
dt.Columns.Add("Field2", typeof(string));

if(ds.Tables[0].Rows.Count > 0)
 {
   foreach(DataRow dr in ds.Tables[0].Rows)
    {
	DrNew = dt.NewRow();
	DrNew[0] = dr["Field1"].ToString();
    }
 }

if(ds.Tables[1].Rows.Count > 0)
 {
   foreach(DataRow dr in ds.Tables[1].Rows)
    {
	DrNew = dt.NewRow();
	DrNew[0] = dr["Field2"].ToString();
    }
 }
dt.AcceptChanges();
 
Is This Answer Correct ?    4 Yes 3 No
Ankur Sehgal
 
  Re: How to merge 2 tables fields in DataTable in asp.net
Answer
# 4
get data from first table and add it as a column in another 
table and do the same way to retrive the second data from 
other table.Add it to third column..
 
Is This Answer Correct ?    1 Yes 2 No
K
 
  Re: How to merge 2 tables fields in DataTable in asp.net
Answer
# 5
DataTable dt1 = retDT("select col1,col2 from Table1");
DataTable dt2 = retDT("select col3,col4 from Table2");
dt1.Merge(dt2);

retDT is a funtion to return datatable based on the query.

The output will be like below
if you check the dt1 content then the output will be

col1 col2 col3 col4
1     2    3    4
 
Is This Answer Correct ?    5 Yes 1 No
Sunil Kumar
 

 
 
 
Other ASP.NET Interview Questions
 
  Question Asked @ Answers
 
what is state management,what is the purpose of it,how it will be implemented in real time?  1
can we call webservice in Html form? Microsoft1
What does this do? sn -t foo.dll  2
how can i insert array values and retreive in asp.net TCS3
How do you make your site SSL enabled ? Satyam2
What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?  6
What r new things introduced in ASP.NET 2.0 in comparision to ASP.NET 1.1  1
what is assembly? Microsoft2
what is Disco?what it will do? Microsoft2
what are the ways to improve performance in .net application? Mind-Tree3
1.What are the types of events in asp.net? 2.what is databind? 3.what is COM objects? 4.Difference between gridview and datalist? 5.what is SOAP? 6.what are contents are available in asp.net page? 7.what are types of error?  1
What is the difference between and ActiveX dll and control ? Microsoft1
Below is a code extract from an ASP.Net application. The code basically reads data from the “name” field in the “members” table and prints them onto the webpage. Using the assumptions provided, fill in the 4 blanks below so that the code will run correctly. ‘Assumptions: ‘conn_str is a variable that holds the connection string to the database ‘Objects dbcomm and dbread are already declared earlier dbcomm = New OleDbCommand("SELECT name FROM members", conn_str) dbread = dbcomm._______________ _____________________ response.write(_______________) _____________________ dbread.Close() Techno-Solutions3
Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.  1
What is shared and private assembly? Accenture1
what is value type to reference type AG-Technologies6
What is custom tag in web.config ? Accenture1
How many time you can fill dataset in asp.net? Syntel1
How is a property designated as read-only?  2
how to get the vb6.0 COM Component in to the .Net application? iSoft3
 
For more ASP.NET Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com