So far, is basically dispise ADO.NET & VB.NET. Here's why:
Too many confusing ways to do simple things. Here are two
examples that maybe someone can help me with:
(1) I have TextBox controls on a form bound to Date fields
in a DataSet. Works great, except that when the TextBox
fields lose focus, when their Text paramter is a Date, the
DataSet (or something) appends the time to it. IOW, I
enter "1/7/2004", move to the next input field, and the
value magically changes itself to "1/7/2004 12:00:00 AM".
(2) I want to use an OleDbParamter to use a SQL "IN"
clause. In other words, sometimes I want to limit the
records on my form to certain Ids, but I want the default
to be all records in the table. The DataAdapter's
SelectCommand is set to "SELECT Id, FirstName FROM
Table". I want to be able to change this to "SELECT Id,
FirstName FROM Table WHERE Id IN (1, 4, 5)" (or
whatever). How can I do this?
Please help. 9 1488
"James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM> schrieb So far, is basically dispise ADO.NET & VB.NET. Here's why:
Too many confusing ways to do simple things. Here are two examples that maybe someone can help me with:
(1) I have TextBox controls on a form bound to Date fields in a DataSet. Works great, except that when the TextBox fields lose focus, when their Text paramter is a Date, the DataSet (or something) appends the time to it. IOW, I enter "1/7/2004", move to the next input field, and the value magically changes itself to "1/7/2004 12:00:00 AM".
I haven't used databinding but I think you can handle the
System.Windows. Forms.Binding.F ormat event to get the right formatting.
(2) I want to use an OleDbParamter to use a SQL "IN" clause. In other words, sometimes I want to limit the records on my form to certain Ids, but I want the default to be all records in the table. The DataAdapter's SelectCommand is set to "SELECT Id, FirstName FROM Table". I want to be able to change this to "SELECT Id, FirstName FROM Table WHERE Id IN (1, 4, 5)" (or whatever). How can I do this?
I don't know if this is the exact syntax (because it's a question for
micrsoft.public .dotnet.framewo rk.adonet):
SELECT Id, FirstName FROM Table WHERE Id IN (@id1, @id2, @id3)
If the number of parameters varies, you have to build the select at runtime
instead of using parameters.
Or without parameters: "...IN (Select Id from temptable)". Table 'temptable'
must be filled before. This is usually only used whenever there can be a
large number of IDs.
--
Armin http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
James, (1) I have TextBox controls on a form bound to Date fields in a DataSet. Works great, except that when the TextBox
This is a side effect of having a single type that holds both Times & Dates.
As Armin suggested, I would look at the Format event to control this.
(2) I want to use an OleDbParamter to use a SQL "IN" clause. In other words, sometimes I want to limit the
I would define two data adapters. One that does all and one that limits.
Alternatively I would define a single stored procedure that was able to do
either, based on its input parameters.
If you don't have it, I would recommend David Sceppa's book "Microsoft
ADO.NET - Core Reference" from MS Press, it is a very good tutorial on using
ADO.NET and also a good desk reference once you know ADO.NET.
Hope this helps
Jay
"James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM> wrote in message
news:0b******** *************** *****@phx.gbl.. . So far, is basically dispise ADO.NET & VB.NET. Here's why:
Too many confusing ways to do simple things. Here are two examples that maybe someone can help me with:
(1) I have TextBox controls on a form bound to Date fields in a DataSet. Works great, except that when the TextBox fields lose focus, when their Text paramter is a Date, the DataSet (or something) appends the time to it. IOW, I enter "1/7/2004", move to the next input field, and the value magically changes itself to "1/7/2004 12:00:00 AM".
(2) I want to use an OleDbParamter to use a SQL "IN" clause. In other words, sometimes I want to limit the records on my form to certain Ids, but I want the default to be all records in the table. The DataAdapter's SelectCommand is set to "SELECT Id, FirstName FROM Table". I want to be able to change this to "SELECT Id, FirstName FROM Table WHERE Id IN (1, 4, 5)" (or whatever). How can I do this?
Please help.
Hi James,
Dates are no simple things in Dotnet.
If you write 1/7/2004 it is for me the first day of july in the year 2004.
While for some others it is the seventh day of january also in 2004
In the EU we use mostly a 24hours clock when official writing it
My 2Eurocents
Cor Too many confusing ways to do simple things. Here are two examples that maybe someone can help me with:
Thanks, I'll try the Binding.Format thing.
About the parameters, though, if I understand you
correctly, there's no way to change the SELECT statement
on an existing DataSet, is that right? If so, this is far
from an improvement over ADODB, don't you think? -----Original Message----- "James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM>
schrieb So far, is basically dispise ADO.NET & VB.NET. Here's
why: Too many confusing ways to do simple things. Here are
two examples that maybe someone can help me with:
(1) I have TextBox controls on a form bound to Date
fields in a DataSet. Works great, except that when the TextBox fields lose focus, when their Text paramter is a Date,
the DataSet (or something) appends the time to it. IOW, I enter "1/7/2004", move to the next input field, and the value magically changes itself to "1/7/2004 12:00:00
AM". I haven't used databinding but I think you can handle the System.Windows .Forms.Binding. Format event to get the
right formatting. (2) I want to use an OleDbParamter to use a SQL "IN" clause. In other words, sometimes I want to limit the records on my form to certain Ids, but I want the
default to be all records in the table. The DataAdapter's SelectCommand is set to "SELECT Id, FirstName FROM Table". I want to be able to change this to "SELECT Id, FirstName FROM Table WHERE Id IN (1, 4, 5)" (or whatever). How can I do this?
I don't know if this is the exact syntax (because it's a
question formicrsoft.publi c.dotnet.framew ork.adonet):
SELECT Id, FirstName FROM Table WHERE Id IN (@id1, @id2,
@id3) If the number of parameters varies, you have to build the
select at runtimeinstead of using parameters.
Or without parameters: "...IN (Select Id from
temptable)". Table 'temptable'must be filled before. This is usually only used whenever
there can be alarge number of IDs.
-- Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
.
"James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM> schrieb Thanks, I'll try the Binding.Format thing.
About the parameters, though, if I understand you correctly, there's no way to change the SELECT statement on an existing DataSet, is that right?
You mean on an existing OleDBCommand? Or you wanna execute an SQL against a
Dataset?
If so, this is far from an improvement over ADODB, don't you think?
Well, in ADODB, you had no parameters at all. Now you can use them in most
cases, but as you saw not in all cases. If you wanna discuss it, the group
microsoft.publi c.dotnet.framew ork.adonet is the better place.
--
Armin http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
FWIW, I found/figured out how to do this:
---------------START CODE SAMPLE----------------
strSQL = "SELECT * FROM TableName WHERE Id IN (1, 4, 7)"
Me.dsDataSetNam e.Clear()
Me.dptAdapterNa me.SelectComman d = _
New System.Data.Ole Db.OleDbCommand (strSQL)
Me.dptAdapterNa me.SelectComman d.Connection =
conConnectionNa me
Me.dptAdapterNa me.Fill(Me.dsDa taSetName, "TableName" )
---------------END CODE SAMPLE----------------
Works great. Thanks for your responses. -----Original Message----- "James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM>
schrieb Thanks, I'll try the Binding.Format thing.
About the parameters, though, if I understand you correctly, there's no way to change the SELECT statement on an existing DataSet, is that right?
You mean on an existing OleDBCommand? Or you wanna
execute an SQL against aDataset?
If so, this is far from an improvement over ADODB, don't you think? Well, in ADODB, you had no parameters at all. Now you can
use them in mostcases, but as you saw not in all cases. If you wanna
discuss it, the groupmicrosoft.publ ic.dotnet.frame work.adonet is the better
place.
-- Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
.
James,
A DataSet does not have a select statement. Only Commands have select
statements. A DataAdapter can have a SelectCommand, plus an Update, Delete &
Create command.
You can change the text of the SelectCommand associated with a DataAdapter &
then repopulate the Parameters. However I have to seriously ask why?
It seems to be more work, when IMHO its easier to have two DataAdapters, one
with the full select & the Update, Delete & Create commands. Plus a second
one with just the partial select. Actually you could have 3 DataAdapters.
One with full select, one with partial select, then one for Update, Delete &
Create.
Remember the DataAdapter you use to Fill a DataSet does not need to be the
DataAdapter you use to Update a DataSet.
Hope this helps
Jay
"James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM> wrote in message
news:00******** *************** *****@phx.gbl.. . Thanks, I'll try the Binding.Format thing.
About the parameters, though, if I understand you correctly, there's no way to change the SELECT statement on an existing DataSet, is that right? If so, this is far from an improvement over ADODB, don't you think?
-----Original Message----- "James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM> schrieb So far, is basically dispise ADO.NET & VB.NET. Here's why: Too many confusing ways to do simple things. Here are two examples that maybe someone can help me with:
(1) I have TextBox controls on a form bound to Date fields in a DataSet. Works great, except that when the TextBox fields lose focus, when their Text paramter is a Date, the DataSet (or something) appends the time to it. IOW, I enter "1/7/2004", move to the next input field, and the value magically changes itself to "1/7/2004 12:00:00 AM". I haven't used databinding but I think you can handle the System.Windows .Forms.Binding. Format event to get the
right formatting. (2) I want to use an OleDbParamter to use a SQL "IN" clause. In other words, sometimes I want to limit the records on my form to certain Ids, but I want the
default to be all records in the table. The DataAdapter's SelectCommand is set to "SELECT Id, FirstName FROM Table". I want to be able to change this to "SELECT Id, FirstName FROM Table WHERE Id IN (1, 4, 5)" (or whatever). How can I do this?
I don't know if this is the exact syntax (because it's a
question formicrsoft.publi c.dotnet.framew ork.adonet):
SELECT Id, FirstName FROM Table WHERE Id IN (@id1, @id2, @id3) If the number of parameters varies, you have to build the
select at runtimeinstead of using parameters.
Or without parameters: "...IN (Select Id from temptable)". Table 'temptable'must be filled before. This is usually only used whenever there can be alarge number of IDs.
-- Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
.
I'm doing this because I have form controls bound to it.
If I had more than one DataAdapter, I'd hve to reboind all
my controls every time I wanted to change the underlying
dataset. That would be insane.
I DID figure out how to do this, BTW. I posted it
yesterday, but here it is again (it's a pretty useful
thing to know how to do:
---------------START CODE SAMPLE----------------
strSQL = "SELECT * FROM TableName WHERE Id IN (1, 4, 7)"
Me.dsDataSetNam e.Clear()
Me.dptAdapterNa me.SelectComman d = _
New System.Data.Ole Db.OleDbCommand (strSQL)
Me.dptAdapterNa me.SelectComman d.Connection = _
conConnectionNa me
Me.dptAdapterNa me.Fill(Me.dsDa taSetName, "TableName" )
---------------END CODE SAMPLE---------------- -----Original Message----- James, A DataSet does not have a select statement. Only Commands
have selectstatements. A DataAdapter can have a SelectCommand, plus
an Update, Delete &Create command.
You can change the text of the SelectCommand associated
with a DataAdapter &then repopulate the Parameters. However I have to
seriously ask why? It seems to be more work, when IMHO its easier to have
two DataAdapters, onewith the full select & the Update, Delete & Create
commands. Plus a secondone with just the partial select. Actually you could have
3 DataAdapters.One with full select, one with partial select, then one
for Update, Delete &Create.
Remember the DataAdapter you use to Fill a DataSet does
not need to be theDataAdapter you use to Update a DataSet.
Hope this helps Jay
"James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM>
wrote in messagenews:00******* *************** ******@phx.gbl. .. Thanks, I'll try the Binding.Format thing.
About the parameters, though, if I understand you correctly, there's no way to change the SELECT statement on an existing DataSet, is that right? If so, this is
far from an improvement over ADODB, don't you think?
>-----Original Message----- >"James" <jrbradyNOSPAM@ NOSPAMsenior-
direct.comNODAM NSPAM> schrieb >> So far, is basically dispise ADO.NET & VB.NET.
Here's why: >> >> Too many confusing ways to do simple things. Here
are two >> examples that maybe someone can help me with: >> >> (1) I have TextBox controls on a form bound to Date fields >> in a DataSet. Works great, except that when the
TextBox >> fields lose focus, when their Text paramter is a
Date, the >> DataSet (or something) appends the time to it. IOW,
I >> enter "1/7/2004", move to the next input field, and
the >> value magically changes itself to "1/7/2004 12:00:00 AM". > >I haven't used databinding but I think you can handle
the >System.Windows .Forms.Binding. Format event to get the right formatting. > >> (2) I want to use an OleDbParamter to use a SQL "IN" >> clause. In other words, sometimes I want to limit
the >> records on my form to certain Ids, but I want the default >> to be all records in the table. The DataAdapter's >> SelectCommand is set to "SELECT Id, FirstName FROM >> Table". I want to be able to change this to "SELECT
Id, >> FirstName FROM Table WHERE Id IN (1, 4, 5)" (or >> whatever). How can I do this? > >I don't know if this is the exact syntax (because it's
a question for >micrsoft.publi c.dotnet.framew ork.adonet): > >SELECT Id, FirstName FROM Table WHERE Id IN (@id1,
@id2, @id3) > >If the number of parameters varies, you have to build
the select at runtime >instead of using parameters. > >Or without parameters: "...IN (Select Id from temptable)". Table 'temptable' >must be filled before. This is usually only used
whenever there can be a >large number of IDs. > >-- >Armin > >http://www.plig.net/nnq/nquote.html >http://www.netmeister.org/news/learn2quote.html > >. >
.
James,
Are these custom controls?
As all the normal form controls bind to a DataView (over a DataTable,
contained in a DataSet). You do not bind to a DataAdapter, you only use the
DataAdapter to fill the DataSet, You can fill a single DataSet from any
number of DataAdapters without rebinding! You can fill a single DataTable
from any number of DataAdapters again without rebinding! As long as the
various DataAdapters have a select command that return compatible columns.
I did not say change the DataSet, I told you to use a different DataAdapter
to fill the DataSet!
I saw your post yesterday, I will continue to recommend multiple
DataAdapters! As IMHO it is the "cleaner" solution. However if your solution
works for you, go for it! I'm sure there is at least a third viable method
you can use to accomplish the same thing!
In case you don't have it, you may want to pick up David Sceppa's book
"Microsoft ADO.NET - Core Reference" from MS Press. It fully explains the
difference between binding to a DataSet and using different DataAdapters to
populate the DataSet! Also David's book is a good tutorial on ADO.NET, plus
a good desk reference once you know ADO.NET.
I hope you realize when I say use two DataAdapters, I mean populate the same
DataTable with two different DataAdapters, do not use two DataAdapters to
populate two DataTables! Otherwise as you say "that would be insane" ;-)
Hope this helps
Jay
"James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM> wrote in message
news:02******** *************** *****@phx.gbl.. . I'm doing this because I have form controls bound to it. If I had more than one DataAdapter, I'd hve to reboind all my controls every time I wanted to change the underlying dataset. That would be insane.
I DID figure out how to do this, BTW. I posted it yesterday, but here it is again (it's a pretty useful thing to know how to do:
---------------START CODE SAMPLE---------------- strSQL = "SELECT * FROM TableName WHERE Id IN (1, 4, 7)" Me.dsDataSetNam e.Clear() Me.dptAdapterNa me.SelectComman d = _ New System.Data.Ole Db.OleDbCommand (strSQL) Me.dptAdapterNa me.SelectComman d.Connection = _ conConnectionNa me Me.dptAdapterNa me.Fill(Me.dsDa taSetName, "TableName" ) ---------------END CODE SAMPLE----------------
-----Original Message----- James, A DataSet does not have a select statement. Only Commands have selectstatements. A DataAdapter can have a SelectCommand, plus an Update, Delete &Create command.
You can change the text of the SelectCommand associated with a DataAdapter &then repopulate the Parameters. However I have to seriously ask why? It seems to be more work, when IMHO its easier to have
two DataAdapters, onewith the full select & the Update, Delete & Create commands. Plus a secondone with just the partial select. Actually you could have 3 DataAdapters.One with full select, one with partial select, then one for Update, Delete &Create.
Remember the DataAdapter you use to Fill a DataSet does not need to be theDataAdapter you use to Update a DataSet.
Hope this helps Jay
"James" <jr***********@ NOSPAMsenior-direct.comNODAM NSPAM> wrote in messagenews:00******* *************** ******@phx.gbl. .. Thanks, I'll try the Binding.Format thing.
About the parameters, though, if I understand you correctly, there's no way to change the SELECT statement on an existing DataSet, is that right? If so, this is far from an improvement over ADODB, don't you think?
>-----Original Message----- >"James" <jrbradyNOSPAM@ NOSPAMsenior- direct.comNODAM NSPAM> schrieb >> So far, is basically dispise ADO.NET & VB.NET. Here's why: >> >> Too many confusing ways to do simple things. Here are two >> examples that maybe someone can help me with: >> >> (1) I have TextBox controls on a form bound to Date fields >> in a DataSet. Works great, except that when the TextBox >> fields lose focus, when their Text paramter is a Date, the >> DataSet (or something) appends the time to it. IOW, I >> enter "1/7/2004", move to the next input field, and the >> value magically changes itself to "1/7/2004 12:00:00 AM". > >I haven't used databinding but I think you can handle the >System.Windows .Forms.Binding. Format event to get the right formatting. > >> (2) I want to use an OleDbParamter to use a SQL "IN" >> clause. In other words, sometimes I want to limit the >> records on my form to certain Ids, but I want the default >> to be all records in the table. The DataAdapter's >> SelectCommand is set to "SELECT Id, FirstName FROM >> Table". I want to be able to change this to "SELECT Id, >> FirstName FROM Table WHERE Id IN (1, 4, 5)" (or >> whatever). How can I do this? > >I don't know if this is the exact syntax (because it's a question for >micrsoft.publi c.dotnet.framew ork.adonet): > >SELECT Id, FirstName FROM Table WHERE Id IN (@id1, @id2, @id3) > >If the number of parameters varies, you have to build the select at runtime >instead of using parameters. > >Or without parameters: "...IN (Select Id from temptable)". Table 'temptable' >must be filled before. This is usually only used whenever there can be a >large number of IDs. > >-- >Armin > >http://www.plig.net/nnq/nquote.html >http://www.netmeister.org/news/learn2quote.html > >. >
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Doug Farrell |
last post by:
Hi all,
I'm trying to do the following from within a code module:
import re
# text to match
text = "Good morning x something /x, how are you today x something
else /x"
|
by: Mathias Mamsch |
last post by:
Hi,
I have some confusion concerning the weakref module.
I am trying to save a weak reference to a bound member function of a class
instance for using it as a callback function. But I always get dead
references, when I try to create a reference to a bound member function. It
seems as if an instance of a class owns no reference to its...
|
by: Grant Edwards |
last post by:
In an interview at http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=273
Alan Kay said something I really liked, and I think it applies
equally well to Python as well as the languages mentioned:
I characterized one way of looking at languages in this
way: a lot of them are either the agglutination of features
or they're a...
|
by: Kamilche |
last post by:
I'm trying to pack two characters into a single byte, and the shifting
in Python has me confused.
Essentially, it should be possible to use a 'packed string' format in
Python, where as long as the characters you're sending are in the ASCII
range 0 to 127, two will fit in a byte.
Here's the code. Can you tell what I'm doing wrong?
...
|
by: JMCN |
last post by:
object invalid or no longer set - confusion of the recordset in access
2003.
i am currently converting from access 97 to access 2003. majority of
the codes converted over perfectly fine, though my recordset did not.
i read from pasts posts that some references will not convert. so i
tried to change the dao 3.51 reference to dao 3.6 in...
| |
by: i_have_control |
last post by:
I'd be grateful for any input on this one:
I have three web domains. The destinations of two are set to folders
on the first, though that fact is transparent to the user (i.e: it does
not REDIRECT to the first domain). Example:
http://www.maindomain.com (main hosted package)
http://www.subdomain1.com -> www.maindomain.com/subdomain1/...
|
by: Steve |
last post by:
I have a form with a dataset and a datagrid.
I created a dataview on this dataset.
When the user modifies the datagrid, I look up this record in the dataview
to make sure it is unique.
Here is the confusion.........
I thought that the DataView is the view from the dataset, but it seems that
the dataview has the records that are in the...
|
by: joelagnel |
last post by:
hi friends,
i've been having this confusion for about a year, i want to know the
exact difference between text and binary files.
using the fwrite function in c, i wrote 2 bytes of integers in binary
mode.
according to me, notepad opens files and each byte of the file
read, it converts that byte from ascii to its correct character and...
|
by: Richard Lewis Haggard |
last post by:
I'm having a problem with what appears to be some sort of confusion with
references. I have a single solution with a dozen projects which has been
working quite nicely for a while. The references between projects in the
solution were established through project references, not by browsing to an
assembly DLL. All of the projects are strongly...
|
by: Riaaaa |
last post by:
Hello,
We are doing the project in VB.Net.
We had a great confusion for ASP.Net and VB.Net.
Is VB.Net project performed in Microsoft Visual Studio 2005 ??
We have created forms in ASP.Net Website selecting the language as Visual Basic in Visual 2005.
We want to do the VB.Net project for the central server...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |