Done with CommandBuilder

  • Thread starter Thread starter tascienu
  • Start date Start date
T

tascienu

Ok, I am done with commandBuilder.

It causes more problem than it solves:

1. Adds unecessary events, that i don't really need.
2. Can't get back AutoIncrement ID of new records.
3. Creates more commands than i need.

I am building my own dataset update method using custom command
builders. One question before i proceed:

Does command builder use a loop to update records, or does it send all
in one statement?

ie:

for each dr as datarow in mydataset.tables(0).rows
' Execute some update statements....
dbExecute(thisRowStatement)
next

or does it just do it in one trip...

for each dr as datarow in mydataset.tables(0).rows
AllsqlStatements &= thisRowStatement...
next

dbExecute(AllsqlStatements)

Thanks for prompt reply...

Tascien
 
Hi,

Ok, I am done with commandBuilder.
Wise.


It causes more problem than it solves:

1. Adds unecessary events, that i don't really need.
2. Can't get back AutoIncrement ID of new records.
3. Creates more commands than i need.

I am building my own dataset update method using custom command
builders. One question before i proceed:

Does command builder use a loop to update records, or does it send all
in one statement?

ie:

for each dr as datarow in mydataset.tables(0).rows
' Execute some update statements....
dbExecute(thisRowStatement)
next

or does it just do it in one trip...

for each dr as datarow in mydataset.tables(0).rows
AllsqlStatements &= thisRowStatement...
next

dbExecute(AllsqlStatements)

Actually the loop is done by DataAdapter, and yes, it is the loop.
 
Tascien:

Believe me when I say I understand your frustration. Unfortunately, the
solution doesn't seem to be as easy as it was using ADO.

I'm still wrestling to come up with a reliable yet non expensive solution. I
think I'm close to it but I have not had much time today to work on it
because i'm wwwaaaayyyyy behind in other things because if been screwing
around with this issue for too long.

You need to answer a few questions anyway

1) Is it a windows or a web app?
2) What do you plan to do with the ID when you get it?
3) Most importantly, are you using typed or untyped dataSets?
4) Are you using any dataAdapters?
5) If yes to #4, did you create them using the wizard or are building them
manualy?
6) Are you creating relations in the XML Schema?
7) What database type are you using? Access? SQL/StoredProc? SQL Table
Direct?

Well, thats more than a few questions.

I will be back later tonight to explain my progress. Basicaly, I'm trying to
use one form for everything. That will probably change. I'm able to pass the
Parent ID to the child tables upon instert. However, I'm unable to fill the
other fields in the child tables until a reload the data. I tried
:mydataAdapter.myInsertCommand.ExecuteSchalar() and it's raising errors yet
works as it should. It does return the AutoID generated by the database and
allow me to place it in a variable. I just have some refining to do.

Talk to ya later

Bob
 
1) Is it a windows or a web app?

( ASP.NET but i use Window Service too )

2) What do you plan to do with the ID when you get it?

Redirect the user to his custom homepage. Default.aspx?UID=10210

3) Most importantly, are you using typed or untyped dataSets?

Typed? Untyped? I am not sure what's the diff, but I never touch the
dataset code. I just do: New Dataset, ds.Fill(Dataset) <--- whatever is
in the sql query.

4) Are you using any dataAdapters?

Was using combined with CommandBuilder.

5) If yes to #4, did you create them using the wizard or are building
them
manualy?

Don't like the wizard. I am assumming that i don't know what fields are
in the table. so, all parameters, fields, even sometimes, Tables, have
to be dynamic. ( at runtime )

6) Are you creating relations in the XML Schema?

No. I use Xml for other pursposes. But when i load Xml dataset, i have
my own generateUniqueID function that returns something of form:

YYYYMMDDHHMMSS RANDOM(1000)
20050912155033134

but for this topic, MSSQL 2000 generates AutoIncrement ID for me.

7) What database type are you using? Access? SQL/StoredProc? SQL Table
Direct?

MSSQL 2000 but i would want my code to be portable.

Tascien

Thanks very much.
 
Tascien:

Ok, now it's making sense. Your issue is a little easier to solve than mine.
Actualy, there is another news group for ASP.NET questions.
microsoft.public.dotnet.framework.aspnet.

Below is a link to an article I found awhile back. It shows how to build a
data access layer. However, I wouldn't use a DAL as they are a little
expensive to the prcesses. You can use this tutorial to do what you need but
without creating a seperate DAL project. Skip the part that has you begin a
sperate project and begin building your data access within the curent
project. Either way it can still be portable. This tutorial even shows you
how to Generate Create Scripts that will enable you to transport the
database portion of your project. you can probably complete both parts of
this tutorial in about 40 mins.


http://www.15seconds.com/issue/030317.htm

HTH


Bob
 
Tascienu,

The most easiest way to get your commands is using the designer.

In 2002/2003 it is named dataadapter, however it is a wizard. That creates
for you the procedures. You can create them. Copy them from the designer
generated part, Paste them in another place and than delete again your
designer parts.

In that way you have an easy start.

I hope this helps,

Cor
 
Back
Top