How to use query using between using this method http://www.mikesdotnetting.com/Article.aspx?ArticleID=70

http://forums.asp.net/p/1253405/2323441.aspx

http://www.mikesdotnetting.com/Article.aspx?ArticleID=26

I couldn't fiqure out how to use this:

select * from table1 where St_Dt between  '1900-01-01' AND '1999-12-31';
Thanks.


Regards

Bishnoi
Tantra Mantra Yantra
0
bishnoi
4/27/2008 2:02:55 PM
asp.net.access-datasource 4679 articles. 0 followers. Follow

3 Replies
999 Views

Similar Articles

[PageSpeed] 3

I think replacing ? by @p1 etc will do the work

 

+++++++++++++++++++++++++++++++++

Dim ConnString As String = utils.GetConnString()

Dim SqlString As String = "Select * From Batch Where ST_DT between @p1 and @p2"

Using conn As New OleDbConnection(ConnString)Using cmd As New OleDbCommand(SqlString, conn)

cmd.CommandType = Data.CommandType.Text

cmd.Parameters.AddWithValue("@p1", TxtToDate.Text)

cmd.Parameters.AddWithValue("@p2", TxtFromDate.Text)

conn.Open()

Using reader As OleDbDataReader = cmd.ExecuteReader()

While reader.Read()

Response.Write(reader("BATCH_NO").ToString())

End While

End Using

End Using

End Using

 

+++++++++++++++++++

Please Tell me if theres any other method.


Regards

Bishnoi
Tantra Mantra Yantra
0
bishnoi
4/27/2008 2:50:32 PM

Yes, it should, but you should have the DateFrom as the first value in the Where clause, and the Date To as the second.  Then you need to make sure the parameters for each are added in the right order.

As an aside, I usually use the >= and <= operatros for date ranges:


Dim ConnString As String = utils.GetConnString()

Dim SqlString As String = "Select * From Batch Where ST_DT >= @p1 and ST_DT <= @p2"

Using conn As New OleDbConnection(ConnString)Using cmd As New OleDbCommand(SqlString, conn)

cmd.CommandType = Data.CommandType.Text

cmd.Parameters.AddWithValue("@p1", TxtFromDate.Text)

cmd.Parameters.AddWithValue("@p2", TxtToDate.Text)

conn.Open()

Using reader As OleDbDataReader = cmd.ExecuteReader()

While reader.Read()

Response.Write(reader("BATCH_NO").ToString())

End While

End Using

End Using

End Using



Regards Mike
[MVP - ASP/ASP.NET]
My site
0
Mikesdotnetting
4/27/2008 6:41:32 PM

Thanks Dear.


Regards

Bishnoi
Tantra Mantra Yantra
0
bishnoi
4/28/2008 1:36:46 AM
Reply:

Similar Artilces:

When to use ( and when to use ((?
I'm just not getting it. When do you use ( in a statement, when do you need to use ((, and is the space after either or both mandatory? For example, I coded this statement: if (( $_ eq $bad_guys_ip )) { more_stuff_here }; Why the two (( in an if? And why does it seem to not work when I miss the space after the ((? Thanx! Mark me as... /Corn-fused|Dense/ > I'm just not getting it. >=20 > When do you use ( in a statement, when do you need to use ((, and is > the space after either or both mandatory? >=20 > For example, I coded this sta...

Using Using
I have just completed reading a chapter in my book on performance. The books says to speed up performance on your web site you should use the using statement when opening connections. My question is how do you catch errors if you are using this as apposed to a try catch block.thanksBryan  Why would you use it as an alternative to a try/catch statement. Couldn't you just do something like  public void UsingSomeMethod() { try { SomeMethod(); } catch(SomeException e) { /// do something useful }}public void SomeMethod() { using (Something) { ...

How to use net use?
Please can any one tell me how to use the dos command net use properly? I have read the help but can't seem to get it to work. Keep getting sytax error message. Thanks in advance. "Beowulf" <who-knows@no-one.com> wrote in message news:9krutk$puu$1@news.grc.com... > Please can any one tell me how to use the dos command net use properly? > > I have read the help but can't seem to get it to work. Keep getting sytax > error message. what are you trying to do? There are about 50 options to "net use" that do a ton of different thin...

How to use HTTP protocol in .Net Remoting? Thanks and Regards,How to use Http protocol in .net Remoting
<>Hi,     <><>How to use HTTP protocol in .Net Remoting ? Is there any specific code bits requires for that ?    I am using TCP protocol it's working but when i change it to  HTTP it throwing an error like "Arugument null exception"<>  Could  anybody give samples for that? Thanks & Regards,Vijay Here is an example of HTTP remoting:http://msdn2.microsoft.com/en-us/library/system.runtime.remoting.channels.http.httpchannel.aspxCheers,       Kev...

superreview requested: [Bug 278821] Access key conflict in Preferences->Advanced->HTTP Networking: both Use HTTP 1.1 and Help use 'H' : [Attachment 171622] Fixed accesskey for Use HTTP 1.1 (H -> E).
Giacomo Magnini <giacomo.magnini@portalis.it> has asked neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> for superreview: Bug 278821: Access key conflict in Preferences->Advanced->HTTP Networking: both Use HTTP 1.1 and Help use 'H' https://bugzilla.mozilla.org/show_bug.cgi?id=278821 Attachment 171622: Fixed accesskey for Use HTTP 1.1 (H -> E). For visibility reasons, I've also changed 2 other accesskeys: Enable Keep-Alive (L -> A) and Enable Pipelining (I -> N) https://bugzilla.mozilla.org/attachment.cgi?id=171622&action=edit ...

superreview granted: [Bug 278821] Access key conflict in Preferences->Advanced->HTTP Networking: both Use HTTP 1.1 and Help use 'H' : [Attachment 171622] Fixed accesskey for Use HTTP 1.1 (H -> E). Fo
neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> has granted Giacomo Magnini <giacomo.magnini@portalis.it>'s request for superreview: Bug 278821: Access key conflict in Preferences->Advanced->HTTP Networking: both Use HTTP 1.1 and Help use 'H' https://bugzilla.mozilla.org/show_bug.cgi?id=278821 Attachment 171622: Fixed accesskey for Use HTTP 1.1 (H -> E). For visibility reasons, I've also changed 2 other accesskeys: Enable Keep-Alive (L -> A) and Enable Pipelining (I -> N) https://bugzilla.mozilla.org/attachment.cgi?id=171622&ac...

How to use the arguments to use() in the package being used
Howdy,=20 The subject says it all believe it or not :) What I'm trying to figure out is how to pass an argument=20 (pragma I believe is the proper term) to use() and do=20 sonethign in the package based on it. I've looked at CGI.pm source but can't seem to track it down.=20 (Similar idea as to CGIs -oldstyle_urls -newstyel_urls) http://search.cpan.org/~lds/CGI.pm-3.04/CGI.pm#PRAGMAS What I'd like to do is something like this: # for old time's sake we'll just use our favorite module use Foo::Monkey qw(:Foo :Bar -doamazingthings); #then in Foo::Monkey...

Using .NET assembly through COM using cominterop
I have a .NET assembly that I call through COM in a classic ASP application using Cominterop.  It used to work fine, however, it's been some time and I've had to make a change and recompile it.  Unfortunately for me, I can't remember how I registered the thing to tell COM how to instantiate it, i.e running regsvr32 and passing the dll returns and error.  I have a .tlb file but I can't remember if I can use that to register the dll??  Hey it's been one busy couple of months!Need help. You could try PInvoke(platform Invoke) solution in this post.  Hope this help...

Using parameters in querying an Access DB and using Datasets
Once a user has logged into my application, they are directed to their admin page.  On there, it will display if they have any new messages.  I can assign the login name to the variable "yourname". The messages are stored in the unimaginatively titled 'messages' table.  The msgto and msgfrom fields are linked to the 'logins' table where the names are stored.  So far, I have created a tableadapter and have the query that will list the required fields for all the messages that are unread: SELECT     m...

When useing www.taobao.com,we can not use the browser.
Name: wuhoo Email: khdotwuhaoatgmaildotcom Product: Firefox Summary: When useing www.taobao.com,we can not use the browser. Comments: www.taobao.com is the most popular web site in china ,we could buy everything with it .But when i pay the money,the website only support IE.So I must exchange my browser. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5 From URL: http://hendrix.mozilla.org/ ...

Could not use ''; file already in use. or Operation must use an updateable query.
 i developed a web application using ms-access and locally it works all fine i able to insert/update and delete but when i publish the web site to shared hosting company, i started having problemssome times i get error like: Operation must use an updateable query.   System.Data.OleDb.OleDbException: Operation must use an updateable query   OR the below error   do you know how do i fix this? i'm really concern will i be able to use ms-access mdb in web ?, i will be hitting around 20 to 50 users, i do not have any other choice but to use MDB. Server Error in '...

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Operation must use an updateable query error when using Access db
I am developing an ASP .NET application at work (Windows 2000 Pro, Access 2000) and have been taking a copy of it home to test. When I run the application at home (Windows XP Pro, Access XP) I can log into the app and display DataGrids, which means I can read data in tables. If I try to update data in a table I get a "Operation must use an updateable query" error. As far as I know, the IIS is configured the same on the two machines. The only differences are the operating systems and the version of MS Access. Any suggestions would be appreciated.Regards, Jim Bonacorda Train H...

There are problems with using the menus on our site (www.prosetsystems.com) when using Firefox
Name: Terry Culling Email: tcullingatprosetsystemsdotcom Product: Firefox Summary: There are problems with using the menus on our site (www.prosetsystems.com) when using Firefox Comments: When someone, who is using Firefox, accesses our Web site (www.prosetsystems.com) our multi-level menu system will not work properly. It has always worked using IE. When you use Firefox, the second level menu comes up on top of the first level menu and is unreadable. Is there a Firefox fix for this or is there something simple we can do to make it work. As it is, we have to tell peo...

Web resources about - How to use query using between using this method http://www.mikesdotnetting.com/Article.aspx?ArticleID=70 - asp.net.access-datasource

Resources last updated: 12/8/2015 9:55:42 PM