In one of the applications that I'm working on I have 2 sets of
functions that build different datasets.
Imagine 4 columns in a datagrid. Inside those 4 columns I have nested
datalists. Two of the datalists' datasources point to database A and
the other two point to database B. This effect allows the client to
perform a side-by-side comparison of the same product so that records
can be updated accordingly. It's easy enough to scroll down and look
for differences but I was asked to make it even easier for the client.
The ultimate goal is to have any changes displayed in red or bold type
so that differences can be spotted at first glance. An example would be
that if Database A has product XYZ's latest version at 3 and Database B
has product XYZ's latest version at 4, then the 4 would be displayed in
red or bold type.
I'm thinking that a cookie might be the way to go but I could be wrong.
Does anyone have any suggestions or references that I can check out to
compare datasets row-by-row? Is there an easier way to go about doing
this?
Nov 19 '05
19 2984
I read some related articles very thoroughly and have at least a
general understanding of how to create the datatable. I have about 8
functions that are tied to my datalists that retrieve data. Each
function has different SQL statements that retrieve specific pieces of
data. What would be the best way of "concatenat ing" onto my current
datatable? If I dim a new datatable in each function won't the
information keep getting rewritten? I haven't found any literature
online in regards to this matter. Everything I've come across
presupposes that there is one subroutine with 2 or more datasets.
You can add as many datatables to a dataset as you'd like to. You just have
to make certain that each datatable has a different name.
For example (Assuming you already have a dataset that contains one or more
datatables) you may add another like so:
Public Function AddTableToDataS et(ByVal dataSetToAddTo As DataSet, ByVal
sqlCommand As SqlCommand, ByVal dataSetTableNam e As String) As DataSet
Try
Dim FortunateDataAd apter As SqlDataAdapter =
GetDataAdapter( sqlCommand)
FortunateDataAd apter.Fill(data SetToAddTo, dataSetTableNam e)
Return dataSetToAddTo
Catch e As Exception
Throw e
End Try
End Function
Sincerely,
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Will Lastname" <wh****@brinkst er.net> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . I read some related articles very thoroughly and have at least a general understanding of how to create the datatable. I have about 8 functions that are tied to my datalists that retrieve data. Each function has different SQL statements that retrieve specific pieces of data. What would be the best way of "concatenat ing" onto my current datatable? If I dim a new datatable in each function won't the information keep getting rewritten? I haven't found any literature online in regards to this matter. Everything I've come across presupposes that there is one subroutine with 2 or more datasets.
So to test this I created a dataset with 2 tables. Let's just say
Table1 and Table2. In going through my FOR Next Loop I tried the
following:
For i = 0 To dsRowCount - 1
If ds.Tables("Tabl e1").Rows(i)("C olumnName") <>
ds.Tables("Tabl e2").Rows(i)("C olumnName") Then
response.write( "not the same")
Else
resposne.write( "ok")
End If
Next i
I am getting an "Object reference not set to an instance of an object."
error when I attempt this. Any suggestions or pointers?
I filled one of the datasets in Function A and the other in Function B
and returned them. Am I not able to access them this way?
Will,
Running in debug mode, does your for next loop error out right away, or make
it through at least one iteration first?
I'm wondering if your tables have the same number of columns in them. If
they don't...
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Will Lastname" <wh****@brinkst er.net> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . So to test this I created a dataset with 2 tables. Let's just say Table1 and Table2. In going through my FOR Next Loop I tried the following:
For i = 0 To dsRowCount - 1 If ds.Tables("Tabl e1").Rows(i)("C olumnName") <> ds.Tables("Tabl e2").Rows(i)("C olumnName") Then response.write( "not the same") Else resposne.write( "ok") End If Next i
I am getting an "Object reference not set to an instance of an object." error when I attempt this. Any suggestions or pointers?
It errors even if I try:
response.write( ds.Tables("Tabl e").Rows(0)("Co lumnName"))
I'm getting so frustrated with this.
Thanks for helping out!
Well, then it's not finding any columns at all for that table.
Try this code (it uses index numbers for the table, rows, columns so that if
the problem is the wrong table name you'll know):
'---Start by making certain that the dataset actually contains at least the
one table.
If ds.Tables(0) Is Nothing Then
Response.Write( "Table Not Found!" & "<br>")
Else
'---Check if any rows exist
If ds.Tables(0).Ro ws.Count > 0 Then
Response.Write( ds.Tables(0).Ro ws.Count.ToStri ng & "<br>")
Response.Write( ds.Tables(0).Ro ws(0).Columns(0 ).ColumnName)
Else
Response.Write( "No Rows Found!")
End If
End If
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Will Lastname" <wh****@brinkst er.net> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. . It errors even if I try:
response.write( ds.Tables("Tabl e").Rows(0)("Co lumnName"))
I'm getting so frustrated with this.
Thanks for helping out!
This writes the name of the column name in the function where I fill
the dataset. If I try to compare a dataset in another function to this
dataset then I get an error.
Will,
I didn't realize you were declaring the dataset object inside of one
function and then using it again in another...
Objects declared within a function are only available within that function.
Instead declare your dataset object as a dataset outside of the first
function near the top of the page but inside of the class.
Private ds As DataSet
Then fill the dataset inside of your first function.
Private Function Number1()
'---Fill ds here
End Function
You won't have to declare ds inside of the function it's available
throughout the whole class.
Now it won't be nothing in the second function.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Will Lastname" <wh****@brinkst er.net> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . This writes the name of the column name in the function where I fill the dataset. If I try to compare a dataset in another function to this dataset then I get an error.
Object reference not set to an instance of an object
Still getting this. I'm going to have to bag this idea for now. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eric |
last post by:
Hello,
I am trying to write a webservice to compare 2 datasets, one recieved
from a client, and the other taken from a database on the webserver.
Sofar, I have had little success in accomplishing that, but that may
be due to the fact that I'm a relative newbie on C# :-)
Does anybody have a clue, a hint, or maybe even some sample code?
|
by: Alpha |
last post by:
I have a small Window application and through out the different forms I
create a different dataset. At the begining I used the Tools to drag and
drop the SqlDataAdapter, connection and dataset objects to the frist few
forms but then later I removed those and created these objects in my code.
I now see 3 datasets in the Solution Explorer panel part but not all the
datasets that I have in my codes. Are these 3 datasets leftover from the...
|
by: Elliot M. Rodriguez |
last post by:
I can accomplish this relatively easily but inefficiently, and it seems like
a hack, but I cant think of a better workaround. Hopefully someone else here
can.
My task is to perform an update on a dataset retrieved from SQL Server 2000
using a stored procedure. This is the base dataset. Users will send an Excel
document up to a webserver and that excel document, which matches the schema
of the SQL dataset (few differences but nothing ...
|
by: GaryDean |
last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much
in answers so I'm reposting some questions posted by some of the programmers
here in our organization that never got answered...
There are articles on the new TableAdapters where it says that a key new
advantage is that a single TableAdapter, which can have multiple queries,
can be used on multiple forms. Now that was in an article on using
TableAdapters with...
|
by: Frank |
last post by:
Hello,
Developing an app where the user fills out a sometimes quite lengthy
form of chkboxes, txtboxes, radbtns, etc. User responses are saved to
a mySql db, which the user can later edit.
When the user chooses to edit, I pull the responses from the db, toss
them in a dataset, check the checks, fill the txtboxes, etc.,etc.
The user then adds, deletes, or changes entries as needed and clicks
the Save Changes button. Here is where the fun...
| |
by: S.Tedeschi |
last post by:
Hi all;
as posted some days ago, I'm converting an on-line app; I used to
heavily rely on strongly-typed DataSets directly dropped onto pages,
and so viewed by code(-behind) as well. In the next two weeks I
discovered that such objects are no more directly usable in pages,
namely in DataGrid which don't see them any more. Even if rebuilt in
Component Designer, and so visible in code, DataSets are invisible in
Page Designer, so now it's...
|
by: Franck |
last post by:
how come unchanged always true even if data changed
This code come from my saving button:
============================================
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
DataSet ds3 = new DataSet();
//Static Dataset which contain values when my form load
|
by: BillE |
last post by:
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.
When I use a business object to populate a gridview, for example, I loop
through a datareader, populating an array list with instances of a custom
class in the middle tier, and then send the array list up to the
presentation layer and bind the gridview to it.
If I use a typed dataset, I...
|
by: gardnern |
last post by:
We have X number of data sets, of Y length each.
For example...
Small, Medium, Large
and
Red, Green, Blue, Yellow
We need to generate a list of all possibilities
Small Red
|
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...
|
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...
| |
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...
|
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,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |