473,387 Members | 1,517 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,387 software developers and data experts.

Accessing dataset datatable table row problem

Hello

I developed and tested a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form.

I used the XML Designer to create an XML .XSD Schema to produce a Dataset.

In looking for a way to start adding data to the dataset programmatically, i
found this method in just about every thing i read.

Dim tripsDataSet As DataSet
tripsDataSet = New DataSet("tripsDS")
tripsDataSet.ReadXmlSchema("c:\inetpub\wwwroot\Coy neTruckWebServices\tripsds.xsd")
tripsDataTbl = tripsDataSet.Tables("tripsTable")
Dim foundTrips() As DataRow

When i try to enter an assignment as below, the IDE will not give me the
intellisense "NewRow()" at the end of the "foundTrips = tripsDataTbl"
statement. It only give me a "GetType".

foundTrips = tripsDataTbl.NewRow()

I i run the program anyway, It bombs out with "No default member found for
type 'DBNull'" on this line

foundTrips(tripidx)("TripDate") = dateAttr.ToString("yyyyMMdd").

dateAttr does have something in it.

How do i get this to work ? I've been trying to figure this out for days.

Any help would be gratefully appreciated.

Thanks,
Tony
Sep 17 '06 #1
2 2665
If you have created a DataSet, you should have a class already defined. You
will instantiate that class, not DataSet. For example, you add a DataSet
called CustomersDS. The line would be:

Dim custDS as New CustomersDS()

If you are doing this on the fly, at runtime (ala the example you gave), you
will NOT have intellisense, as something created at runtime is not available
at design time.

Once you instantiate as a strongly typed dataset, you should be in good
shape. The type of row you will want to add, however, is of the type of the
name of the table and you will pull it from the methods in the strongly
typed dataset instead of a generic new row.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"Tony Girgenti" <tony(nospam)@lakesideos.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hello

I developed and tested a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form.

I used the XML Designer to create an XML .XSD Schema to produce a Dataset.

In looking for a way to start adding data to the dataset programmatically,
i found this method in just about every thing i read.

Dim tripsDataSet As DataSet
tripsDataSet = New DataSet("tripsDS")
tripsDataSet.ReadXmlSchema("c:\inetpub\wwwroot\Coy neTruckWebServices\tripsds.xsd")
tripsDataTbl = tripsDataSet.Tables("tripsTable")
Dim foundTrips() As DataRow

When i try to enter an assignment as below, the IDE will not give me the
intellisense "NewRow()" at the end of the "foundTrips = tripsDataTbl"
statement. It only give me a "GetType".

foundTrips = tripsDataTbl.NewRow()

I i run the program anyway, It bombs out with "No default member found
for type 'DBNull'" on this line

foundTrips(tripidx)("TripDate") = dateAttr.ToString("yyyyMMdd").

dateAttr does have something in it.

How do i get this to work ? I've been trying to figure this out for days.

Any help would be gratefully appreciated.

Thanks,
Tony

Sep 17 '06 #2
OK. Now i have it like this:

Dim tripsDataSet As New tripsDS
Dim tripsDataTbl As New tripsDS.tripsTableDataTable
tripsDataSet.ReadXmlSchema("c:\inetpub\wwwroot\Coy neTruckWebServices\tripsds.xsd")
Dim foundTrips As DataRow
foundTrips = tripsDataTbl.NewRow

When i run it, it blows up on the ReadXmlSchema line with " Invalid 'Key'
node inside constraint named: tripsTableRel".

I'm not sure i follow what you are trying to explain to me.
>If you are doing this on the fly, at runtime (ala the example you gave),
you
will NOT have intellisense, as something created at runtime is not available
at design time <<

Is there another way to do this if not at run time ?
>The type of row you will want to add, however, is of the type of the
name of the table and you will pull it from the methods in the strongly
typed dataset instead of a generic new row <<

The table i defined has a row type ?

I hope you don't mind me asking so many questions. It's just that i am
trying to learn this new technology and i spend days on trying to resolve
problems by researching and reading. My posts here usually come after that
and when i get a reply, i try to seize the opportunity to learn as much as i
can from a knowledgeable individual such as yourself.

Thanks,
Tony

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:e8**************@TK2MSFTNGP02.phx.gbl...
If you have created a DataSet, you should have a class already defined.
You will instantiate that class, not DataSet. For example, you add a
DataSet called CustomersDS. The line would be:

Dim custDS as New CustomersDS()

If you are doing this on the fly, at runtime (ala the example you gave),
you will NOT have intellisense, as something created at runtime is not
available at design time.

Once you instantiate as a strongly typed dataset, you should be in good
shape. The type of row you will want to add, however, is of the type of
the name of the table and you will pull it from the methods in the
strongly typed dataset instead of a generic new row.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"Tony Girgenti" <tony(nospam)@lakesideos.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>Hello

I developed and tested a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form.

I used the XML Designer to create an XML .XSD Schema to produce a
Dataset.

In looking for a way to start adding data to the dataset
programmatically, i found this method in just about every thing i read.

Dim tripsDataSet As DataSet
tripsDataSet = New DataSet("tripsDS")
tripsDataSet.ReadXmlSchema("c:\inetpub\wwwroot\Co yneTruckWebServices\tripsds.xsd")
tripsDataTbl = tripsDataSet.Tables("tripsTable")
Dim foundTrips() As DataRow

When i try to enter an assignment as below, the IDE will not give me the
intellisense "NewRow()" at the end of the "foundTrips = tripsDataTbl"
statement. It only give me a "GetType".

foundTrips = tripsDataTbl.NewRow()

I i run the program anyway, It bombs out with "No default member found
for type 'DBNull'" on this line

foundTrips(tripidx)("TripDate") = dateAttr.ToString("yyyyMMdd").

dateAttr does have something in it.

How do i get this to work ? I've been trying to figure this out for
days.

Any help would be gratefully appreciated.

Thanks,
Tony


Sep 18 '06 #3

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

Similar topics

2
by: theWizK | last post by:
Hello all. I have noticed that when I generate a strongly-typed dataset from an xml schema that the DataTables that are generated have their constructors marked as internal. What this means is...
3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
1
by: Fleckman | last post by:
I have a situation where I need to add rows to tables with a Parent-Child relationship which presents a constraints violation when I reject the changes. Here is the scenario: I add a row to a...
1
by: Moojjoo | last post by:
Good Monday Morning: I am at a dead stop and I am hoping some other developers out there can help me out. I have built a dataset that first contains a table populated from SQL Server then I am...
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
0
by: N. Demos | last post by:
Hello, I'm having problems accessing a complex XML child node (latitude & longitude), and passing it to a function when the XML file has been read into a DataSet. Specifically, the returned object...
5
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is...
16
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
12
by: Andy B | last post by:
I need to custom build and use a dataset in c# to use with xml. Does anybody know where I can find out how to do something like this? I was going to create a class that generated the dataset and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
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...
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...

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.