PC Review


Reply
Thread Tools Rate Thread

commandbuilder generated sql commands

 
 
=?Utf-8?B?TmVkaW0=?=
Guest
Posts: n/a
 
      13th Sep 2004
is there a way to influence the sql command that the commandbuilder
generates???? by default, those are extremely "ugly" sql commands, and i
don't really understand the purpose of all the sql that is generated

below is one such command, and i'm using a database (fox .dbc file) that
errs "sql statement too long" when i try to run this command (using
dataadapter.update() method for updating a row in a table)

what is the parameters after the where ... clause? i understand the first
part where it searches for the matching row via a primary key value but those
?= 1 OR something parts really confuse me.
please help

UPDATE rsdkdat SET rs_datrea = ? , rs_posmat = ? , rs_datdok = ? , rs_datpre
= ? , rs_datpri = ? , rs_novter = ? , rs_opimov = ? , rs_tipvla = ? WHERE (
(rs_brjdok = ?) AND ((? = 1 AND rs_datrea IS NULL) OR (rs_datrea = ?)) AND
((? = 1 AND rs_tipnal IS NULL) OR (rs_tipnal = ?)) AND ((? = 1 AND rs_posmat
IS NULL) OR (rs_posmat = ?)) AND ((? = 1 AND rs_brjlok IS NULL) OR (rs_brjlok
= ?)) AND ((? = 1 AND rs_primat IS NULL) OR (rs_primat = ?)) AND ((? = 1 AND
rs_sifmov IS NULL) OR (rs_sifmov = ?)) AND ((? = 1 AND rs_stabro IS NULL) OR
(rs_stabro = ?)) AND ((? = 1 AND rs_napom1 IS NULL) OR (rs_napom1 = ?)) AND
((? = 1 AND rs_napom2 IS NULL) OR (rs_napom2 = ?)) AND ((? = 1 AND rs_demdin
IS NULL) OR (rs_demdin = ?)) AND ((? = 1 AND rs_vriskl IS NULL) OR (rs_vriskl
= ?)) AND ((? = 1 AND rs_staslg IS NULL) OR (rs_staslg = ?)) AND ((? = 1 AND
rs_valpla IS NULL) OR (rs_valpla = ?)) AND ((? = 1 AND rs_indskl IS NULL) OR
(rs_indskl = ?)) AND ((? = 1 AND rs_tipkup IS NULL) OR (rs_tipkup = ?)) AND
((? = 1 AND rs_datdok IS NULL) OR (rs_datdok = ?)) AND ((? = 1 AND rs_radmod
IS NULL) OR (rs_radmod = ?)) AND ((? = 1 AND rs_datpre IS NULL) OR (rs_datpre
= ?)) AND ((? = 1 AND rs_terpre IS NULL) OR (rs_terpre = ?)) AND ((? = 1 AND
rs_vrjpre IS NULL) OR (rs_vrjpre = ?)) AND ((? = 1 AND rs_tipser IS NULL) OR
(rs_tipser = ?)) AND ((? = 1 AND rs_sersav IS NULL) OR (rs_sersav = ?)) AND
((? = 1 AND rs_usenam IS NULL) OR (rs_usenam = ?)) AND ((? = 1 AND rs_brjori
IS NULL) OR (rs_brjori = ?)) AND ((? = 1 AND rs_regozn IS NULL) OR (rs_regozn
= ?)) AND ((? = 1 AND rs_datreg IS NULL) OR (rs_datreg = ?)) AND ((? = 1 AND
rs_kilome IS NULL) OR (rs_kilome = ?)) AND ((? = 1 AND rs_brjsas IS NULL) OR
(rs_brjsas = ?)) AND ((? = 1 AND rs_brjmot IS NULL) OR (rs_brjmot = ?)) AND
((? = 1 AND rs_datpri IS NULL) OR (rs_datpri = ?)) AND ((? = 1 AND rs_vrizak
IS NULL) OR (rs_vrizak = ?)) AND ((? = 1 AND rs_vripre IS NULL) OR (rs_vripre
= ?)) AND ((? = 1 AND rs_novter IS NULL) OR (rs_novter = ?)) AND ((? = 1 AND
rs_sifrad IS NULL) OR (rs_sifrad = ?)) AND ((? = 1 AND rs_orgjed IS NULL) OR
(rs_orgjed = ?)) AND ((? = 1 AND rs_vrsrad IS NULL) OR (rs_vrsrad = ?)) AND
((? = 1 AND rs_gorivo IS NULL) OR (rs_gorivo = ?)) AND ((? = 1 AND rs_zamdje
IS NULL) OR (rs_zamdje = ?)) AND ((? = 1 AND rs_tiprad IS NULL) OR (rs_tiprad
= ?)) AND ((? = 1 AND rs_opimov IS NULL) OR (rs_opimov = ?)) AND ((? = 1 AND
rs_tipvla IS NULL) OR (rs_tipvla = ?)) )

 
Reply With Quote
 
 
 
 
Val Mazur
Guest
Posts: n/a
 
      13th Sep 2004
Hi,

You cannot influence how CommandBuilder generates this statement, but you do
not have to use CommandBuilder in your code. What you could do is to create
Update, Delete and Insert command using your own code and specify your own
SQL statements for them.

--
Val Mazur
Microsoft MVP


"Nedim" <(E-Mail Removed)> wrote in message
news:249C71E6-8F0C-4C2A-A9C0-(E-Mail Removed)...
> is there a way to influence the sql command that the commandbuilder
> generates???? by default, those are extremely "ugly" sql commands, and i
> don't really understand the purpose of all the sql that is generated
>
> below is one such command, and i'm using a database (fox .dbc file) that
> errs "sql statement too long" when i try to run this command (using
> dataadapter.update() method for updating a row in a table)
>
> what is the parameters after the where ... clause? i understand the first
> part where it searches for the matching row via a primary key value but
> those
> ?= 1 OR something parts really confuse me.
> please help
>
> UPDATE rsdkdat SET rs_datrea = ? , rs_posmat = ? , rs_datdok = ? ,
> rs_datpre
> = ? , rs_datpri = ? , rs_novter = ? , rs_opimov = ? , rs_tipvla = ? WHERE
> (
> (rs_brjdok = ?) AND ((? = 1 AND rs_datrea IS NULL) OR (rs_datrea = ?)) AND
> ((? = 1 AND rs_tipnal IS NULL) OR (rs_tipnal = ?)) AND ((? = 1 AND
> rs_posmat
> IS NULL) OR (rs_posmat = ?)) AND ((? = 1 AND rs_brjlok IS NULL) OR
> (rs_brjlok
> = ?)) AND ((? = 1 AND rs_primat IS NULL) OR (rs_primat = ?)) AND ((? = 1
> AND
> rs_sifmov IS NULL) OR (rs_sifmov = ?)) AND ((? = 1 AND rs_stabro IS NULL)
> OR
> (rs_stabro = ?)) AND ((? = 1 AND rs_napom1 IS NULL) OR (rs_napom1 = ?))
> AND
> ((? = 1 AND rs_napom2 IS NULL) OR (rs_napom2 = ?)) AND ((? = 1 AND
> rs_demdin
> IS NULL) OR (rs_demdin = ?)) AND ((? = 1 AND rs_vriskl IS NULL) OR
> (rs_vriskl
> = ?)) AND ((? = 1 AND rs_staslg IS NULL) OR (rs_staslg = ?)) AND ((? = 1
> AND
> rs_valpla IS NULL) OR (rs_valpla = ?)) AND ((? = 1 AND rs_indskl IS NULL)
> OR
> (rs_indskl = ?)) AND ((? = 1 AND rs_tipkup IS NULL) OR (rs_tipkup = ?))
> AND
> ((? = 1 AND rs_datdok IS NULL) OR (rs_datdok = ?)) AND ((? = 1 AND
> rs_radmod
> IS NULL) OR (rs_radmod = ?)) AND ((? = 1 AND rs_datpre IS NULL) OR
> (rs_datpre
> = ?)) AND ((? = 1 AND rs_terpre IS NULL) OR (rs_terpre = ?)) AND ((? = 1
> AND
> rs_vrjpre IS NULL) OR (rs_vrjpre = ?)) AND ((? = 1 AND rs_tipser IS NULL)
> OR
> (rs_tipser = ?)) AND ((? = 1 AND rs_sersav IS NULL) OR (rs_sersav = ?))
> AND
> ((? = 1 AND rs_usenam IS NULL) OR (rs_usenam = ?)) AND ((? = 1 AND
> rs_brjori
> IS NULL) OR (rs_brjori = ?)) AND ((? = 1 AND rs_regozn IS NULL) OR
> (rs_regozn
> = ?)) AND ((? = 1 AND rs_datreg IS NULL) OR (rs_datreg = ?)) AND ((? = 1
> AND
> rs_kilome IS NULL) OR (rs_kilome = ?)) AND ((? = 1 AND rs_brjsas IS NULL)
> OR
> (rs_brjsas = ?)) AND ((? = 1 AND rs_brjmot IS NULL) OR (rs_brjmot = ?))
> AND
> ((? = 1 AND rs_datpri IS NULL) OR (rs_datpri = ?)) AND ((? = 1 AND
> rs_vrizak
> IS NULL) OR (rs_vrizak = ?)) AND ((? = 1 AND rs_vripre IS NULL) OR
> (rs_vripre
> = ?)) AND ((? = 1 AND rs_novter IS NULL) OR (rs_novter = ?)) AND ((? = 1
> AND
> rs_sifrad IS NULL) OR (rs_sifrad = ?)) AND ((? = 1 AND rs_orgjed IS NULL)
> OR
> (rs_orgjed = ?)) AND ((? = 1 AND rs_vrsrad IS NULL) OR (rs_vrsrad = ?))
> AND
> ((? = 1 AND rs_gorivo IS NULL) OR (rs_gorivo = ?)) AND ((? = 1 AND
> rs_zamdje
> IS NULL) OR (rs_zamdje = ?)) AND ((? = 1 AND rs_tiprad IS NULL) OR
> (rs_tiprad
> = ?)) AND ((? = 1 AND rs_opimov IS NULL) OR (rs_opimov = ?)) AND ((? = 1
> AND
> rs_tipvla IS NULL) OR (rs_tipvla = ?)) )
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      15th Sep 2004
See my article on the CommandBuilder. http://www.betav.com/msdn_magazine.htm

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Nedim" <(E-Mail Removed)> wrote in message
news:249C71E6-8F0C-4C2A-A9C0-(E-Mail Removed)...
> is there a way to influence the sql command that the commandbuilder
> generates???? by default, those are extremely "ugly" sql commands, and i
> don't really understand the purpose of all the sql that is generated
>
> below is one such command, and i'm using a database (fox .dbc file) that
> errs "sql statement too long" when i try to run this command (using
> dataadapter.update() method for updating a row in a table)
>
> what is the parameters after the where ... clause? i understand the first
> part where it searches for the matching row via a primary key value but
> those
> ?= 1 OR something parts really confuse me.
> please help
>
> UPDATE rsdkdat SET rs_datrea = ? , rs_posmat = ? , rs_datdok = ? ,
> rs_datpre
> = ? , rs_datpri = ? , rs_novter = ? , rs_opimov = ? , rs_tipvla = ? WHERE
> (
> (rs_brjdok = ?) AND ((? = 1 AND rs_datrea IS NULL) OR (rs_datrea = ?)) AND
> ((? = 1 AND rs_tipnal IS NULL) OR (rs_tipnal = ?)) AND ((? = 1 AND
> rs_posmat
> IS NULL) OR (rs_posmat = ?)) AND ((? = 1 AND rs_brjlok IS NULL) OR
> (rs_brjlok
> = ?)) AND ((? = 1 AND rs_primat IS NULL) OR (rs_primat = ?)) AND ((? = 1
> AND
> rs_sifmov IS NULL) OR (rs_sifmov = ?)) AND ((? = 1 AND rs_stabro IS NULL)
> OR
> (rs_stabro = ?)) AND ((? = 1 AND rs_napom1 IS NULL) OR (rs_napom1 = ?))
> AND
> ((? = 1 AND rs_napom2 IS NULL) OR (rs_napom2 = ?)) AND ((? = 1 AND
> rs_demdin
> IS NULL) OR (rs_demdin = ?)) AND ((? = 1 AND rs_vriskl IS NULL) OR
> (rs_vriskl
> = ?)) AND ((? = 1 AND rs_staslg IS NULL) OR (rs_staslg = ?)) AND ((? = 1
> AND
> rs_valpla IS NULL) OR (rs_valpla = ?)) AND ((? = 1 AND rs_indskl IS NULL)
> OR
> (rs_indskl = ?)) AND ((? = 1 AND rs_tipkup IS NULL) OR (rs_tipkup = ?))
> AND
> ((? = 1 AND rs_datdok IS NULL) OR (rs_datdok = ?)) AND ((? = 1 AND
> rs_radmod
> IS NULL) OR (rs_radmod = ?)) AND ((? = 1 AND rs_datpre IS NULL) OR
> (rs_datpre
> = ?)) AND ((? = 1 AND rs_terpre IS NULL) OR (rs_terpre = ?)) AND ((? = 1
> AND
> rs_vrjpre IS NULL) OR (rs_vrjpre = ?)) AND ((? = 1 AND rs_tipser IS NULL)
> OR
> (rs_tipser = ?)) AND ((? = 1 AND rs_sersav IS NULL) OR (rs_sersav = ?))
> AND
> ((? = 1 AND rs_usenam IS NULL) OR (rs_usenam = ?)) AND ((? = 1 AND
> rs_brjori
> IS NULL) OR (rs_brjori = ?)) AND ((? = 1 AND rs_regozn IS NULL) OR
> (rs_regozn
> = ?)) AND ((? = 1 AND rs_datreg IS NULL) OR (rs_datreg = ?)) AND ((? = 1
> AND
> rs_kilome IS NULL) OR (rs_kilome = ?)) AND ((? = 1 AND rs_brjsas IS NULL)
> OR
> (rs_brjsas = ?)) AND ((? = 1 AND rs_brjmot IS NULL) OR (rs_brjmot = ?))
> AND
> ((? = 1 AND rs_datpri IS NULL) OR (rs_datpri = ?)) AND ((? = 1 AND
> rs_vrizak
> IS NULL) OR (rs_vrizak = ?)) AND ((? = 1 AND rs_vripre IS NULL) OR
> (rs_vripre
> = ?)) AND ((? = 1 AND rs_novter IS NULL) OR (rs_novter = ?)) AND ((? = 1
> AND
> rs_sifrad IS NULL) OR (rs_sifrad = ?)) AND ((? = 1 AND rs_orgjed IS NULL)
> OR
> (rs_orgjed = ?)) AND ((? = 1 AND rs_vrsrad IS NULL) OR (rs_vrsrad = ?))
> AND
> ((? = 1 AND rs_gorivo IS NULL) OR (rs_gorivo = ?)) AND ((? = 1 AND
> rs_zamdje
> IS NULL) OR (rs_zamdje = ?)) AND ((? = 1 AND rs_tiprad IS NULL) OR
> (rs_tiprad
> = ?)) AND ((? = 1 AND rs_opimov IS NULL) OR (rs_opimov = ?)) AND ((? = 1
> AND
> rs_tipvla IS NULL) OR (rs_tipvla = ?)) )
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying the sql commands generated by commandbuilder? cj Microsoft VB .NET 1 20th Dec 2005 08:29 AM
Commands and CommandBuilder Pashkuale Microsoft ADO .NET 4 13th Oct 2005 09:41 AM
DataAdapter using commandbuilder's commands, not it's own. Marina Microsoft ASP .NET 1 12th Dec 2003 05:46 PM
Inserting identity columns with CommandBuilder generated commands? Carl Mercier Microsoft ADO .NET 9 24th Nov 2003 12:46 AM
CommandBuilder commands Konrad Microsoft ADO .NET 4 18th Sep 2003 06:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:25 AM.