|
-
Dec 19th, 2001, 03:24 AM
#1
Thread Starter
New Member
submit dataset to database
hi everyone,
i'm a newbee on this forum, and looking for help
This is my problem:
I have tried to fill a dataset from a database
this is done bij a stored procedure
(Getting data from multiple tables!)
Here is the code for that part:
..........
ComCD = New OleDbCommand("cmdTwoInOne", MyConn)
Debug.WriteLine("test select: " & intAr_ID)
ComCD.Parameters.Add("@ArtiestID", OleDbType.Integer)
ComCD.Parameters("@ArtiestID").Value = intAr_ID
ComCD.CommandType = CommandType.StoredProcedure
daCDs.SelectCommand = ComCD
daCDs.FillSchema(dsCD, SchemaType.Source, "tblCD")
daCDs.Fill(dsCD, "tblCD")
.......
When i have the dataset i want to update a row in it
no problem so far.
But when i want to submit the changes of the dataset to the database...it goes wrong
Here is the code how i do that:
Public Sub UpdateCD(ByVal test As DataSet)
If MyConn.State = ConnectionState.Open Then
Else
MyConn.Open()
End If
Dim custCD As OleDbCommandBuilder = New OleDbCommandBuilder(myCommand)
myCommand.Update(test, "tblCD")
......
in the last rule it goes wrong: mycommand.Update(test,"tblCD")
I'm getting this error:
Value null was found where an instance of an object was required.
I don't no why?
Is it because there are combined tables in the dataset?
If so where can i find information on the net on updating database with combined tables?
Can somebody please help me out!
Thanx guys...
-
Dec 19th, 2001, 10:04 AM
#2
maybe a dumb question, but you are passing the dataset into the Update Sub right? Just trying the easy questions first.
-
Dec 20th, 2001, 07:59 AM
#3
Thread Starter
New Member
yes i pass it trough the Update....
But i found the problem and i made a work a round
I loaded the dataset with a stored procedure that create combined tables...
i made changes to this dataset and then i wanted to update
de database(DB) table...
But the table in de dataset does not exist in de DB....
I guess this is the problem....
As work around i updated the record directly to the DB and
read back the data into the dataset....
this is not the right way but......
I still have a long way to go in .NET!!
If there is a way to update a dataset (to DB) with combined tables,
i would like to hear this....
The resources on www don't tel anything about it!!!!
Thx Cander for your reply
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|