473,395 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

error on query of derived datatable in dataset

Get data into datatable, add to dataset dsSearch "

Get data into datatable, add to dataset dsSearch

Using In-Memory SQL Engine join the tables and select the filenames from the
join, add to dataset dsSearch
CODE ON
http://www.planet-source-code.com/vb...3994&lngWId=10

using SQL connection get data from view on sql server, add to dataset dsSearch

What I want to do is use dsHelper code from MS to create a relationship
join the derived third datatable and the sql connection datatable (fourth)
then fill the created table with query of third and fourth datatables.
I can assign the third derived table to a grid and see results. Using one of
the filenames from the grid I can get data out of view, view in grid ok also
the error comes creating the join, it does not like the DocFiles.FileTitle
because it is derived? or because I am using table named when it is added to
dataset?

MICROSOFT DSHELPER
http://support.microsoft.com/default...b;en-us;326080

------------------------------------------------------------
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
{
DataColumn dc = SourceTable.Columns[Field.FieldName];
dt.Columns.Add(dc.ColumnName, dc.DataType, dc.Expression);
}
else

----------------------------------------------------------
CODE IS DONE ON PAGE LOAD

First
DataTable dt = dsSearch.Tables.Add("Lists");
dt.Columns.Add("ListTitle", typeof(string));
foreach (SPSearchResult oSR in oSRSet)
{
string title = oSR.Title.ToString();
dt.Rows.Add(new Object[] {title});
}
Second
DataTable dt1 = dsSearch.Tables.Add("Docs");
dt1.Columns.Add("DocTitle", typeof(string));
foreach (SPSearchResult oSR in oSRSet1)
{
string title = oSR.Title.ToString();
dt1.Rows.Add(new Object[] {title});
}
Third
SelectCommand sc = new SelectCommand(dsSearch);
DataTable dtm = dsSearch.Tables.Add("DocFiles");
dtm.Columns.Add("FileTitle",typeof(string));
dtm = sc.Execute("Select ListTitle from Lists inner join Docs on
Lists.ListTitle = Docs.DocTitle");
Fourth
DataTable dtProps = dsSearch.Tables.Add("DocProps");
SqlConnection connection = new SqlConnection(mystr);
SqlCommand command = new SqlCommand();
string sql = "Select * from view";
SqlDataAdapter adapter = new SqlDataAdapter();
command.CommandText = sql;
command.Connection = connection;
adapter.SelectCommand = command;
adapter.Fill(dtProps);
dsHelper JOin
dsSearch.Relations.Add("relationResult",
dsSearch.Tables["DocProps"].Columns["LeafName"],
dsSearch.Tables["DocFiles"].Columns["FileTitle"]);
dsHelper.CreateJoinTable("SearchPage",dsSearch.Tab les["DocProps"],"Modality,[Product Series],Abstract,[Doc Type],[Revised Date],[LeafName]");

dsHelper Fill
dsHelper.InsertJoinInto(dsSearch.Tables["SearchPage"],
dsSearch.Tables["DocProps"],
"Modality,Abstract,ProductSeries,DocType,RevisedDa te,DocFiles.FileTitle
docname",null,"docname");


--
cindy
Nov 19 '05 #1
1 1993
Hi Cindy,

Welcome to ASPNET newsgroup. Regarding on this issue, I've also found
another cross thread in the

Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls

A community guy has posted his response there. Please feel free to followup
there.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| Thread-Topic: error on query of derived datatable in dataset
| thread-index: AcXeQ7Mf6tJ4d1UnQt+PUdAyAXM4+A==
| X-WBNR-Posting-Host: 71.136.160.3
| From: "=?Utf-8?B?Y2luZHk=?=" <cm****@nospam.nospam>
| Subject: error on query of derived datatable in dataset
| Date: Mon, 31 Oct 2005 09:51:19 -0800
| Lines: 94
| Message-ID: <CB**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:135035
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Get data into datatable, add to dataset dsSearch "
|
| Get data into datatable, add to dataset dsSearch
|
| Using In-Memory SQL Engine join the tables and select the filenames from
the
| join, add to dataset dsSearch
| CODE ON
|
http://www.planet-source-code.com/vb...odeId=3994&lng
WId=10
|
| using SQL connection get data from view on sql server, add to dataset
dsSearch
|
| What I want to do is use dsHelper code from MS to create a relationship
| join the derived third datatable and the sql connection datatable (fourth)
| then fill the created table with query of third and fourth datatables.
|
|
| I can assign the third derived table to a grid and see results. Using one
of
| the filenames from the grid I can get data out of view, view in grid ok
also
| the error comes creating the join, it does not like the
DocFiles.FileTitle
| because it is derived? or because I am using table named when it is added
to
| dataset?
|
| MICROSOFT DSHELPER
| http://support.microsoft.com/default...b;en-us;326080
|
| ------------------------------------------------------------
| Exception Details: System.NullReferenceException: Object reference not
set
| to an instance of an object.
|
| Source Error:
|
|
| {
| DataColumn dc = SourceTable.Columns[Field.FieldName];
| dt.Columns.Add(dc.ColumnName, dc.DataType, dc.Expression);
| }
| else
|
|
|
| ----------------------------------------------------------
| CODE IS DONE ON PAGE LOAD
|
| First
| DataTable dt = dsSearch.Tables.Add("Lists");
| dt.Columns.Add("ListTitle", typeof(string));
| foreach (SPSearchResult oSR in oSRSet)
| {
| string title = oSR.Title.ToString();
| dt.Rows.Add(new Object[] {title});
| }
| Second
| DataTable dt1 = dsSearch.Tables.Add("Docs");
| dt1.Columns.Add("DocTitle", typeof(string));
| foreach (SPSearchResult oSR in oSRSet1)
| {
| string title = oSR.Title.ToString();
| dt1.Rows.Add(new Object[] {title});
| }
| Third
| SelectCommand sc = new SelectCommand(dsSearch);
| DataTable dtm = dsSearch.Tables.Add("DocFiles");
| dtm.Columns.Add("FileTitle",typeof(string));
| dtm = sc.Execute("Select ListTitle from Lists inner join Docs on
| Lists.ListTitle = Docs.DocTitle");
| Fourth
| DataTable dtProps = dsSearch.Tables.Add("DocProps");
| SqlConnection connection = new SqlConnection(mystr);
| SqlCommand command = new SqlCommand();
| string sql = "Select * from view";
| SqlDataAdapter adapter = new SqlDataAdapter();
| command.CommandText = sql;
| command.Connection = connection;
| adapter.SelectCommand = command;
| adapter.Fill(dtProps);
| dsHelper JOin
| dsSearch.Relations.Add("relationResult",
| dsSearch.Tables["DocProps"].Columns["LeafName"],
| dsSearch.Tables["DocFiles"].Columns["FileTitle"]);

dsHelper.CreateJoinTable("SearchPage",dsSearch.Tab les["DocProps"],"Modality,
[Product Series],Abstract,[Doc Type],[Revised Date],[LeafName]");
|
| dsHelper Fill
| dsHelper.InsertJoinInto(dsSearch.Tables["SearchPage"],
| dsSearch.Tables["DocProps"],
| "Modality,Abstract,ProductSeries,DocType,RevisedDa te,DocFiles.FileTitle
| docname",null,"docname");
|
|
|
|
|
|
| --
| cindy
|

Nov 19 '05 #2

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

Similar topics

3
by: Jon | last post by:
I'm learning about datatables. When using the example provided by MS in the ..NET Framework Class Library for DATATABLE (see below) I get an error on line 3 that says "Type expected". Is something...
1
by: andrewcw | last post by:
I have just 1 table that I am updating, the SQL I use to generate the DataTable is complex using multiple tables, however when I view the fieldnames of the DataTable from the DataSet - everything...
0
by: Phill W. | last post by:
(Using VB'2005) I'm trying to serialise a DataSet that contains a "table" that is a Class derived from DataTable. <Serializable()_ Class CustomDataTable Inherits DataTable . . . I create...
3
by: John J. Hughes II | last post by:
I have a SqlDataAdapter.Fill filling a standard dataset and my code is returning the below error. The "Error Loading data" is just a message my code displays. "Error:" is the Exception.Message...
5
by: Omer | last post by:
Hi, I am using C# 2.0 along with MS Access database. All my queries are working perfectly fine, but one inner join query is ocntinously throwing. I ahve tried it both from code and running...
3
by: Phill W. | last post by:
OK, I've asked nicely before; now I'm going to throw down the gauntlet to anyone brave enough to take it up. In VB'2005, can anyone write me a class that inherits from System.Data.DataTable, add...
29
by: =?Utf-8?B?SGVybWF3aWg=?= | last post by:
Hello, Please anybody help me. I have only a little experience with web development. I created simple project using ASP NET 2.0 (VS 2005) It works fine on local computer. When I tried to run...
1
by: Danny | last post by:
Hi guys, I sometimes get the following error on my ASP.NET webpage. Server Error in '/' Application. -------------------------------------------------------------------------------- ...
6
by: fniles | last post by:
I am using VB.NET 2005 and Access database. My program uses a timer that kicks in every 1 min to read from a database and copy the dataset table to a datatable. This database is in a class called...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.