473,480 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Error creating a dataset

Hi, I am trying to create a dataset with 6 tables and 5 relationships created between them. I am creating it in the Form_Load event. However i keep getting the following error...

An unhandled exception of type 'System.ArgumentNullException' occurred in system.data.dll
Additional information: 'column' argument cannot be null.

The code stops on this line...
Dim rel_Booking_CaraBook As New DataRelation("dsFullBooking", dsFullBooking.Tables("dtBooking").Columns("Booking ID"), dsFullBooking.Tables("dtCaraBooking").Columns("Boo kingID"))

Does anyone know what im doin wrong??
Here is my full code....

Dim dsFullBooking As New DataSet()
'create the customer datatable
da = New SqlDataAdapter("SELECT * FROM Client", Cn)
da.Fill(dsFullBooking, "dtClient")
'create the booking datatable
da = New SqlDataAdapter("SELECT * FROM Booking", Cn)
da.Fill(dsFullBooking, "dtBooking")
'create the Caravan_Booking datatable
da = New SqlDataAdapter("SELECT * FROM Caravan_Booking", Cn)
da.Fill(dsFullBooking, "dtCaraBooking")
'create the Room_booking datatable
da = New SqlDataAdapter("SELECT * FROM Room_Booking", Cn)
da.Fill(dsFullBooking, "dtRoomBooking")
'create the Meal_Booking datatable
da = New SqlDataAdapter("SELECT * FROM Meal_Bookings", Cn)
da.Fill(dsFullBooking, "dtMealBooking")

'----------Relationships
Dim rel_Client_Booking As New DataRelation("dsFullBooking", dsFullBooking.Tables
("dtClient").Columns("ClientID"), dsFullBooking.Tables("dtBooking").Columns("ClientI D")) dsFullBooking.Relations.Add(rel_Client_Booking)

Dim rel_Booking_CaraBook As New DataRelation("dsFullBooking", dsFullBooking.Tables
("dtBooking").Columns("BookingID"), dsFullBooking.Tables("dtCaraBooking").Columns
("BookingID"))
dsFullBooking.Relations.Add(rel_Booking_CaraBook)
Dim rel_Booking_RoomBook As New DataRelation("dsFullBooking", dsFullBooking.Tables
("dtBooking").Columns("BookingID"), dsFullBooking.Tables("dtRoomBooking").Columns
("BookingID"))

dsFullBooking.Relations.Add(rel_Booking_RoomBook)

'Declare the Columns for the datarelation (for compound keys)
Dim RoomBookColumns(4) As DataColumn
Dim MealBookColumns(4) As DataColumn

RoomBookColumns(0) = dsFullBooking.Tables("dtRoomBooking").Columns("Boo kingID")
RoomBookColumns(1) = dsFullBooking.Tables("dtRoomBooking").Columns("Roo mID")
RoomBookColumns(2) = dsFullBooking.Tables("dtRoomBooking").Columns("Roo mDt")
RoomBookColumns(3) = dsFullBooking.Tables("dtRoomBooking").Columns("Req _Session")

MealBookColumns(0) = dsFullBooking.Tables("dtMealBooking").Columns("Boo kingID")
MealBookColumns(1) = dsFullBooking.Tables("dtMealBooking").Columns("Roo mID")
MealBookColumns(2) = dsFullBooking.Tables("dtMealBooking").Columns("Roo mDt")
MealBookColumns(3) = dsFullBooking.Tables("dtMealBooking").Columns("Req _Session")

Dim rel_RoomBook_MealBook As New DataRelation("myRelationName", RoomBookColumns,
MealBookColumns, True)
dsFullBooking.Relations.Add(rel_RoomBook_MealBook)
any help is appreciated

Jul 21 '05 #1
6 2668
Cor
Hi Jade,

Did you check all the names like BookingID with me this is mostly a case
error that I did make.

VB is in this case also case sensetive

Cor
Jul 21 '05 #2
Hi Cor

I have checked all the coloumn names and they all match up to what is in my database!
What i wasnt sure about is if i need to use the SQLDataReader to place a single value into a textbox. Is this the easiest/best way to do this?

This is the code i found on the net to add values to a combobox. I modified it for my purposes

Is it correct?
Jul 21 '05 #3
Hi Cor,

I have checked all the column headings and they are correct!!!
Is my syntax correct? I used a web example to get this code which i tailored to my own needs.

btw, do not read my post below this as i posted here by accident. :o)
Jul 21 '05 #4
Cor
Hi Jade,

For me it becomes also guessing now, but I see you did give all your
datarelations the name
"dsFullBooking" maybe if you give them an unique name (that is as I use it)

Cor

">
I have checked all the column headings and they are correct!!!
Is my syntax correct? I used a web example to get this code which i

tailored to my own needs.
Jul 21 '05 #5
Hi Cor

I have elimated many of the errors i have and i am on the last part of my code now. :o

I am getting the following error..
An unhandled exception of type 'System.ArgumentNullException' occurred in system.data.dl
Additional information: 'column' argument cannot be null

the code stops at this line...
Dim rel_RoomBook_MealBook As New DataRelation("rel_RoomBook_MealBook",
RoomBookColumns, MealBookColumns, True

the code for this relationship is listed below. This relationship is coded differently to the other as both relations contain a compound key.
do u know what this message concerns?? could it be anything to do with the fact that the meal_Booking table in my database does not contain any data therefore it has nothing to join with on the room_bookings table??? Can the data affect this

'Declare the Columns for the datarelation (for compound keys
Dim RoomBookColumns(4) As DataColum
Dim MealBookColumns(4) As DataColum

RoomBookColumns(0) = dsFullBooking.Tables("dtRoomBooking").Columns("Boo kingNo"
RoomBookColumns(1) = dsFullBooking.Tables("dtRoomBooking").Columns("Roo mID"
RoomBookColumns(2) = dsFullBooking.Tables("dtRoomBooking").Columns("Roo mDt"
RoomBookColumns(3) = dsFullBooking.Tables("dtRoomBooking").Columns("Req _Session"

MealBookColumns(0) = dsFullBooking.Tables("dtMealBooking").Columns("Boo kingNo"
MealBookColumns(1) = dsFullBooking.Tables("dtMealBooking").Columns("Roo mID"
MealBookColumns(2) = dsFullBooking.Tables("dtMealBooking").Columns("Roo mDt"
MealBookColumns(3) = dsFullBooking.Tables("dtMealBooking").Columns("Req _Session"

'Add the name and DataColumn arrays to the Relatio
Dim rel_RoomBook_MealBook As New DataRelation("rel_RoomBook_MealBook",
RoomBookColumns, MealBookColumns, True
'Add the Relation to the DataSe
dsFullBooking.Relations.Add(rel_RoomBook_MealBook)
Jul 21 '05 #6
Cor
Hi Jade,
the code for this relationship is listed below. This relationship is coded differently to the other as both relations contain a compound key. do u know what this message concerns?? could it be anything to do with the

fact that the meal_Booking table in my database does not contain any data
therefore it has nothing to join with on the room_bookings table??? Can the
data affect this?

I thik you are right

I would try what the fillschema could do for me

http://msdn.microsoft.com/library/de...chematopic.asp

you have than an empty dataset with a good schema

Cor


Jul 21 '05 #7

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

Similar topics

0
1112
by: Pat | last post by:
All, I wrote a front end of a sql submitter for lack of better words. Simply I am passing in a query ( strSQL ) built in a text box on the client screen. If it runs, I bind the data to a...
13
2245
by: Edward Mitchell | last post by:
I have a problem that involves the error I receive when attempting to complete the asp.net web application example (Walkthrough: Creating a Web Application Using a Third-Party Business Object). ...
1
1997
by: cindy | last post by:
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...
21
1790
by: Carolyn | last post by:
I've got a program that collects info from an Access. I'm trying to use the following select command to select all the information from the "Families" table and store it in a dataset, plus join...
6
1563
by: Steve Amey | last post by:
Hi all I want to be able to throw a custom error up the call stack. I have looked around and it seems as though it's possible, but I can't get it to work :o( Below is some sample code. ...
0
260
by: Jade | last post by:
Hi, I am trying to create a dataset with 6 tables and 5 relationships created between them. I am creating it in the Form_Load event. However i keep getting the following error... An unhandled...
9
3437
by: dennist685 | last post by:
I created a web project named 'Access' in C:\Inetpub\wwwroot\Access and dropped an .mdb there. I dragged a DetailView to the form, configured it to show two fields of a table, and got...
0
1341
by: David | last post by:
I am trying to migrate a .net 1.1 Web Application to a 2.0 Web Application. I am experiencing issues when putting a strongly typed dataset into session, and then navigation to a page where...
13
2862
by: Jerry C | last post by:
I am using some sample code from gotdotnet to Create DataSet mappings from a xsd schema. I am geting this error. code and error below. I might mention there is also a publictypelibrary file with...
0
7044
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,...
0
6908
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
7087
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
6944
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...
1
4782
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...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.