473,387 Members | 1,745 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.

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 2660
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
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
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
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
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
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
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
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
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
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
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.