dbTalk Databases Forums  

SSE2008: #Tables, Stored Procedures, Avoiding ActiveX

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss SSE2008: #Tables, Stored Procedures, Avoiding ActiveX in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-01-2012 , 03:30 PM






On Wed, 01 Aug 2012 20:59:06 +0200, Erland Sommarskog
<esquel (AT) sommarskog (DOT) se> wrote:

Quote:
Gene Wirchenko (genew (AT) ocis (DOT) net) writes:
It is not multiple errors. It is multiple rows of error data
being returned. Preliminarily, it is an error message row followed by
zero or more rows of inculpated column names. e.g.
OrderBy ErrorResponse
0 Foo must be less than bar.
1 foo
2 bar
0 is the error message to be emitted. 1 and 2 are the involved
columns from which the front-end will select the first one in the form
tab sequence to set the focus to.

There are of course error checks that belongs in the database, because
they work with the data. This does not the least apply to update procedures.
Huh? Of course it involves updates. I do not want bad data
getting into the database. That is the point of the error checks.

Did you misstate, or am I missing some context here?

Quote:
However, I would recommend that you don't overdo it. T-SQL is not a very
good language from a general programming perspective. Earlier this day
I was battling how to formulate an error message that for a while read
like:

Column(s) [a] exists only in the left table, but they are not at the end

While the message can apply to multiple columns, I expect that most commonly
there will be only one, so the bad grammar will hurts the eye. Had I written
this code in Perl I might have crafted a message that was correct both
for singular and plural, but in T-SQL the code for that would be just too
verbose, and I eventually I found a way to convey the message that did
not depend on verb inflection.
I have already written some proof-of-concept code that does
return what I need. To do so, I created a constraints table that has
the names of the columns associated with each constraint. That is
where I get the columnnames that are returned to the browser. I think
it will scale up.

Quote:
I think I've written something like you have in mind about once in my
career. And that was in SQL 2000 with no TRY-CATCH. With TRY-CATCH it
becomes even more difficult to produce multiple error message. Unless
you return them as result sets, but then you need a clear protocol so
that your client knows what result set gets back.
My protocol that I have already described is simple. I think it
will work.

Quote:
Something I've used a little more often is when I have had a table with
rows that needs to be processed, and each row is processed independently, or
at least there are groups of rows that are independent of each other.
In such cases, I put a status column and a message column in the table
where I write error status and message.
Do you mean that your input table gets modified with the result?
Something like:
SomeKey }
Data1 } Process
Data2 } this.
Data3 }
ProcessingStatus } What happened
ProcessingErrorMessage } goes here.

Sincerely,

Gene Wirchenko

Reply With Quote
  #22  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-01-2012 , 04:27 PM






Gene Wirchenko (genew (AT) ocis (DOT) net) writes:
Quote:
Huh? Of course it involves updates. I do not want bad data
getting into the database. That is the point of the error checks.

Did you misstate, or am I missing some context here?
The example you posted was a retrieval procedure. I can only work
from the code I see, not the code I don't see.

Quote:
Do you mean that your input table gets modified with the result?
Something like:
SomeKey }
Data1 } Process
Data2 } this.
Data3 }
ProcessingStatus } What happened
ProcessingErrorMessage } goes here.
Yup. These are typicall background processes of some sort. In many cases
there is data coming from an external source, and this data needs to
be validated, as it could have errors.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
  #23  
Old   
Jason Keats
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-04-2012 , 03:14 AM



Erland Sommarskog wrote:
Quote:
Gene Wirchenko (genew (AT) ocis (DOT) net) writes:
My understanding is that in order to access the data with the
browser, I have to create an ADODB.Connection object and an
ADODB.Recordset object using ActiveXObject() which Firefox (for
example) does not have. If there is another way of doing it, I would
be delighted to find out how.

Old ADO is a technology that dead in the sense that there is no further
development with it - and has not been for a decade or so. It exists
in legacy applications, but it is nothing you should use for a new
application in 2012. ADO was crap already in its heyday, and now it also
suffers from lack of support for new features in SQL Server.

You should use ADO .Net, or possibly JDBC or PHP as your data access API.
(The old thing old ADO and ADO .Net has in common are three letters.)

As for being browser-independent or not - if you make your application
to run on IE only, you will have to deal with irritated users who prefers
to use a different browser.
ADO was installed as part of MDAC, but is now part of WDAC which comes
with the operating system of Windows Vista and later. ADO is not yet
deprecated, and is (AFAIK still) THE way to access your SQL Server data
- if you're not using a .NET programming language.

Reply With Quote
  #24  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-04-2012 , 02:15 PM



Jason Keats (jkeats (AT) melbpcDeleteThis (DOT) org.au) writes:
Quote:
ADO was installed as part of MDAC, but is now part of WDAC which comes
with the operating system of Windows Vista and later. ADO is not yet
deprecated, and is (AFAIK still) THE way to access your SQL Server data
- if you're not using a .NET programming language.

No, that would be ODBC.

ADO does not fully support new data types added to SQL Server. The ones
that are supported are only because they fit into the OLE DB framework
at the time, for instance the date data type. (Where as time does not
work, since the time data type in SQL Server does not mach TIME in
OLE DB.)


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
  #25  
Old   
Jason Keats
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-05-2012 , 03:10 AM



Erland Sommarskog wrote:
Quote:
Jason Keats (jkeats (AT) melbpcDeleteThis (DOT) org.au) writes:
ADO was installed as part of MDAC, but is now part of WDAC which comes
with the operating system of Windows Vista and later. ADO is not yet
deprecated, and is (AFAIK still) THE way to access your SQL Server data
- if you're not using a .NET programming language.


No, that would be ODBC.
Fair enough.

However, Microsoft created DAO, RDO and ADO for a reason. These
high-level COM APIs wrap ODBC to make life easier, more productive (ie
better), for programmers using languages like VB6, FoxPro, Delphi, etc.

I agree that...

Quote:
ADO does not fully support new data types added to SQL Server. The ones
that are supported are only because they fit into the OLE DB framework
at the time, for instance the date data type. (Where as time does not
work, since the time data type in SQL Server does not mach TIME in
OLE DB.)
But, for anyone using ADO (and not the ODBC API), the solution is not to
use incompatible data types in your database! :-)

Reply With Quote
  #26  
Old   
Jason Keats
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-05-2012 , 09:03 AM



Erland Sommarskog wrote:
Quote:
And today if you write native code, I would assume that your language is
C++, where ODBC rather fits better than ADO.

But, for anyone using ADO (and not the ODBC API), the solution is not to
use incompatible data types in your database! :-)


Right. The solution is to switch to an API that gives full support for
what the database exposes.
Thanks for the feedback, Erland.

It looks like its time to drop VB6 and ADO and move to C++ and ODBC. ;-)

Reply With Quote
  #27  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-05-2012 , 01:21 PM



Jason Keats (jkeats (AT) melbpcDeleteThis (DOT) org.au) writes:
Quote:
It looks like its time to drop VB6 and ADO and move to C++ and ODBC. ;-)

Or .Net. There is still room for native code - SQL Server is full of that -
but the applications that are in native code because they should be were
rarely implemented in VB6.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
  #28  
Old   
Jason Keats
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-06-2012 , 04:44 AM



Erland Sommarskog wrote:
Quote:
Jason Keats (jkeats (AT) melbpcDeleteThis (DOT) org.au) writes:
It looks like its time to drop VB6 and ADO and move to C++ and ODBC. ;-)


Or .Net. There is still room for native code - SQL Server is full of that -
but the applications that are in native code because they should be were
rarely implemented in VB6.
That was supposed to be a joke, Erland. I doubt very much that I'll ever
use C++ or ODBC (directly). I am using .NET on the server. It's just
unfortunate that Microsoft doesn't have a good (ie, not C++) native code
replacement for VB6.

Reply With Quote
  #29  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: SSE2008: #Tables, Stored Procedures, Avoiding ActiveX - 08-06-2012 , 01:54 PM



Jason Keats (jkeats (AT) melbpcDeleteThis (DOT) org.au) writes:
Quote:
Erland Sommarskog wrote:
Jason Keats (jkeats (AT) melbpcDeleteThis (DOT) org.au) writes:
It looks like its time to drop VB6 and ADO and move to C++ and ODBC. ;-)


Or .Net. There is still room for native code - SQL Server is full of
that - but the applications that are in native code because they should
be were rarely implemented in VB6.

That was supposed to be a joke, Erland. I doubt very much that I'll ever
use C++ or ODBC (directly). I am using .NET on the server. It's just
unfortunate that Microsoft doesn't have a good (ie, not C++) native code
replacement for VB6.
Admittedly, I am outside my expertise, but if you want native code because
managed code has too much overhead, why would want something like VB6?

C++ may look more scary than VB6, but given that C++ has inheritance
and VB6 does not, I am not sure that VB6 is overall more productive
for what you would write in native code today.



--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.