Some dataset advice please

V

Vayse

I have a form bound to a dataset. The form displays an Asset. There is also
a grid on the form bound to a Schedules table, which is a Schedule for that
asset. So its very like a master/detail form.

Some questions:

1) Is it a mistake to use the Data Sources explorer for my forms? Would I be
better off to just fill the text boxes through my own code, and then write
back.

2) The AssetsDataSet that is created - is this the same dataset throughout
the project? Say I have 3 forms, frmAssets, frmCalendar, frmCustomer. Each
uses AssetsDataSet - is it the same one, or a copy each time?

3) At the moment, I am using a temporary table, TempSchedule, to show the
user what the new schedule would look like. If the user clicks Save, I
update the Schedule table with the contents of the TempSchedule table. Code
is below.
Would it be possible to do this in the dataset, without creating a temporary
table?

Thanks
Vayse

Dim stSQL As String
Dim cnnAsset As New ADODB.Connection ' Connection to the database
cnnAsset.Open(conCONNECT)
stSQL = "DELETE * FROM Schedule WHERE Sch_AssetCode = '" &
Me.txtAssetCode.Text & "'"
cnnAsset.Execute(stSQL, lRecords)
stSQL = "INSERT INTO Schedule SELECT TempSchedule.* FROM TempSchedule"
cnnAsset.Execute(stSQL, lRecords)
cnnAsset.Close()
 
J

Jeffrey Tan[MSFT]

Hi Vayse,

Currently we are looking for someone to help you on this issue, we will
reply to you ASAP. Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
K

Kevin Yu [MSFT]

Hi Vayse,

1. Are you working on VS.NET 2005? If so, creating the TextBoxes by
dragging and dropping from the Data Source Explorer will be fine.

2. Do you mean the AssetsDataSet created by the windows form designer in
this Form? If so, this instance of DataSet is not the same one throughout
the project, it is only an instance in this form (maybe frmAssets). If you
need it to be throughout the project, you have to write your own code for
this Dataset.

3. You can set an update command for the DataAdapter and make changes in
the DataSet. When you call DataAdapter.Update, the changes in the DataSet
will be put into the database.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconUpdatingDatabaseWithDataAdapterDataSet.asp

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
K

Kevin Yu [MSFT]

You're welcome.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top