<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Access Databases and AccessDataSource Control</title><link>http://forums.asp.net/55.aspx</link><description>Discuss using Access as a data store for ASP.NET, and the AccessDataSource control.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Problems with date format in Access 2007</title><link>http://forums.asp.net/thread/3404092.aspx</link><pubDate>Mon, 14 Sep 2009 16:23:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3404092</guid><dc:creator>Hanwell</dc:creator><author>Hanwell</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3404092.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3404092</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;got mine working too thanks for the help did the following.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="vb.net" name="code"&gt;Imports System.Data.OleDb
Imports System.Data

Partial Class Members_Admin_AddEvent
    Inherits System.Web.UI.Page

    Protected Sub DropDownOFirstName_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownOFirstName.DataBound
        DropDownOFirstName.Items.Insert(0, &amp;quot;Please Select Member&amp;quot;)
    End Sub



    Protected Sub DropDownDMFirstName_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownDMFirstName.DataBound
        DropDownDMFirstName.Items.Insert(0, &amp;quot;Please Select Member&amp;quot;)
    End Sub

    Protected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click
        If Page.IsValid Then
            Dim ConnString As String = &amp;quot;Provider=Microsoft.Jet.OleDb.4.0;Data Source=|DataDirectory|membership.mdb&amp;quot;

            Dim SqlString As String = &amp;quot;INSERT INTO TBL_Events(MemberID, DiveManagerID, [Date], Location, Duration, Details) VALUES (?, ?, ?, ?, ?, ?)&amp;quot;

            Using conn As New OleDbConnection(ConnString)

                Using cmd As New OleDbCommand(SqlString, conn)

                    cmd.CommandType = CommandType.Text

                    cmd.Parameters.AddWithValue(&amp;quot;MemberID&amp;quot;, DropDownOFirstName.SelectedValue)

                    cmd.Parameters.AddWithValue(&amp;quot;DiveManagerID&amp;quot;, DropDownDMFirstName.SelectedValue)
                    cmd.Parameters.AddWithValue(&amp;quot;Date&amp;quot;, Convert.ToDateTime(TextBoxStartDate.Text).ToOADate)
                    cmd.Parameters.AddWithValue(&amp;quot;Location&amp;quot;, TextBoxLocation.Text)
                    cmd.Parameters.AddWithValue(&amp;quot;Duration&amp;quot;, TextBoxDuration.Text)
                    cmd.Parameters.AddWithValue(&amp;quot;Details&amp;quot;, TextBoxDetails.Text)

                    conn.Open()

                    cmd.ExecuteNonQuery()

                End Using

            End Using&lt;/pre&gt;&lt;pre class="vb.net" name="code"&gt;got some tips from &lt;/pre&gt;&lt;pre class="vb.net" name="code"&gt;&lt;a href="http://www.mikesdotnetting.com/Article/26/Parameter-Queries-in-ASP.NET-with-MS-Access"&gt;http://www.mikesdotnetting.com/Article/26/Parameter-Queries-in-ASP.NET-with-MS-Access&lt;/a&gt;&lt;/pre&gt;&lt;pre class="vb.net" name="code"&gt;and made the connection with tips from &lt;/pre&gt;&lt;pre class="vb.net" name="code"&gt;&lt;a href="http://www.asp101.com/articles/john/connstring/default.asp"&gt;http://www.asp101.com/articles/john/connstring/default.asp&lt;/a&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Problems with date format in Access 2007</title><link>http://forums.asp.net/thread/3273690.aspx</link><pubDate>Fri, 03 Jul 2009 14:35:02 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273690</guid><dc:creator>hans_v</dc:creator><author>hans_v</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273690.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3273690</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;pavan496:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Using parameterized queries solved my problem&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And it will save you from many other problems also, like SQL injections, and it makes your code more readable and structured....&lt;/p&gt;
&lt;p&gt;You&amp;#39;re Welcome &lt;img title="Cool" border="0" alt="Cool" src="http://forums.asp.net/tiny_mce/jscripts/tiny_mce/plugins/emotions/img/smiley-cool.gif" /&gt;&lt;/p&gt;</description></item><item><title>Re: Problems with date format in Access 2007</title><link>http://forums.asp.net/thread/3273575.aspx</link><pubDate>Fri, 03 Jul 2009 13:22:36 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273575</guid><dc:creator>pavan496</dc:creator><author>pavan496</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273575.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3273575</wfw:commentRss><description>&lt;p&gt;Thankyou very much.. Using parameterized queries solved my problem.. Thanks a lot...&lt;/p&gt;&lt;p&gt;Regards&lt;/p&gt;</description></item><item><title>Re: Problems with date format in Access 2007</title><link>http://forums.asp.net/thread/3273220.aspx</link><pubDate>Fri, 03 Jul 2009 09:52:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273220</guid><dc:creator>hans_v</dc:creator><author>hans_v</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273220.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3273220</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;v.vivek:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;
&lt;p&gt;use cdate()&amp;nbsp; function. i hope this solve ur problem.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The problems begin when you &amp;#39;re using the&amp;nbsp;cdate() function in an SQL statement. The trick is to do all the conversions from String to Date in VB or C#, because then you make use of the globalisation you want to use, and add the date as as parameter to the SQL command.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;</description></item><item><title>Re: Problems with date format in Access 2007</title><link>http://forums.asp.net/thread/3273145.aspx</link><pubDate>Fri, 03 Jul 2009 09:16:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273145</guid><dc:creator>v.vivek</dc:creator><author>v.vivek</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273145.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3273145</wfw:commentRss><description>&lt;p&gt;use cdate()&amp;nbsp; function. i hope this solve ur problem.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Problems with date format in Access 2007</title><link>http://forums.asp.net/thread/3272960.aspx</link><pubDate>Fri, 03 Jul 2009 07:40:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272960</guid><dc:creator>hans_v</dc:creator><author>hans_v</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272960.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3272960</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;pavan496:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Similarly, i changed the format of the date field in access 2007 table to dd/MM/yyyy wherever needed.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is nonsense. What you&amp;#39;re doing there is specifying how a date is represented when you&amp;#39;re using Access as application. But also in the access application,&amp;nbsp; ýou did not, and you can not specify how a date is stored internally. In fact, all dates in Access are stored as numbers! But In an ASP.NET environment, you&amp;#39;re not dealing with an access database, but with a Jet Database Engine. When you are entering dates in aa/bb/cccc format, Jet willl thread that as according to the culture.&lt;/p&gt;
&lt;p&gt;When you set a culture, then all dates (and numbers) are shown by default according to that culture. If you didn&amp;#39;t set a culture, ASP.NET uses the culture of the users browser. When a user is entereing a date in a textbox, the same is happening. So when you have a textbox where a user entered a date. all you need to do is convert it to a datetime:&lt;/p&gt;
&lt;p&gt;dim aDate = Convert.ToDateTime(TextBox1.Text)&lt;/p&gt;
&lt;p&gt;The Date in the TextBox will be handled as specified in the culture, either the culture of the users browser, or, if you did set a culture in web.config, by that culture&lt;/p&gt;
&lt;p&gt;A simple test will show what I just explained&lt;/p&gt;
&lt;p&gt;Drag a textbox (TextBox1), a Label (Label1) and a Button (Button1) on a Form. In the code behind enter:&lt;span style="FONT-SIZE:xx-small;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="vb.net" name="code"&gt;Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim aDate As DateTime = Convert.ToDateTime(TextBox1.Text)
        TextBox1.Text = aDate.ToShortDateString
        Label11.Text = aDate.Day.ToString
End Sub
&lt;/pre&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY:;FONT-SIZE:xx-small;"&gt;&lt;font size="1"&gt;
&lt;p&gt;&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;/span&gt;
&lt;p&gt;&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/span&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you set the Culture in web.config to en-GB, and enter 2/1/2009 in the textbox and click the button, the label will show that the day is 2&lt;/p&gt;
&lt;p&gt;When you enter 2/13/2009, that it will throw an error, because it isn&amp;#39;t a valid date, because 13 is threated as the month&lt;/p&gt;
&lt;p&gt;When you change the CUltue in web.config to en-US and enter 2/1/2009, the label will show that the day is 1&lt;/p&gt;
&lt;p&gt;When you enter 2/13/2009, the label will show that the day is 13&lt;/p&gt;
&lt;p&gt;And when you enter 13/1/2009, it will throw an error&lt;/p&gt;
&lt;p&gt;One more thing. When entering data in a database, always use parmeterized queries&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.mikesdotnetting.com/Article.aspx?ArticleID=26"&gt;http://www.mikesdotnetting.com/Article.aspx?ArticleID=26&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;when entering a date, convert the date into a Ole Automation date:&lt;/p&gt;
&lt;p&gt;cmd.Parameters.AddWithValue(&amp;quot;DateField&amp;quot;, Convert.ToDateTime(&amp;quot;DateString&amp;quot;).ToOADate)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Problems with date format in Access 2007</title><link>http://forums.asp.net/thread/3272641.aspx</link><pubDate>Fri, 03 Jul 2009 04:38:44 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272641</guid><dc:creator>asifchouhan</dc:creator><author>asifchouhan</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272641.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3272641</wfw:commentRss><description>&lt;p&gt;Try this&lt;/p&gt;&lt;p&gt;&amp;nbsp;For example:&lt;/p&gt;&lt;p&gt;
&lt;font size="2" color="#0000ff"&gt;
&lt;p&gt;&amp;lt;&lt;font size="2" color="#800000"&gt;appSettings&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;&amp;gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;font size="2" color="#800000"&gt;add&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt; &lt;/font&gt;&lt;font size="2" color="#ff0000"&gt;key&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;=&lt;/font&gt;&lt;font size="2"&gt;&amp;quot;&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;MY_DATE_FORMAT&lt;/font&gt;&lt;font size="2"&gt;&amp;quot;&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt; &lt;/font&gt;&lt;font size="2" color="#ff0000"&gt;value&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;=&lt;/font&gt;&lt;font size="2"&gt;&amp;quot;&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;{0:dd-MMM-yy}&lt;/font&gt;&lt;font size="2"&gt;&amp;quot;&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" color="#0000ff"&gt;&amp;lt;&lt;font size="2" color="#800000"&gt;/appSettings&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Then you could refer to this value in your code wherever you need it, like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;asp:Label ID=&amp;quot;lblDate&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%# Eval(&amp;quot;IssueDate&amp;quot;, &lt;b&gt;&lt;font size="2"&gt;System.Configuration.ConfigurationManager.AppSettings(&amp;quot;MY_DATE_FORMAT&amp;quot;)&lt;/font&gt;&lt;/b&gt;) %&amp;gt;&amp;#39;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Regards&lt;/p&gt;&lt;p&gt;Asif&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Problems with date format in Access 2007</title><link>http://forums.asp.net/thread/3272495.aspx</link><pubDate>Fri, 03 Jul 2009 02:31:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272495</guid><dc:creator>pavan496</dc:creator><author>pavan496</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272495.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3272495</wfw:commentRss><description>&lt;p&gt;Hello, I have an asp.net application with ms access as the database. I want the date format in the whole application to be in dd/MM/yyyy format, so i changed the culture to &amp;quot;en-GB&amp;quot; in web.config file. Similarly, i changed the format of the date field in access 2007 table to dd/MM/yyyy wherever needed.&lt;/p&gt;&lt;p&gt;Now, my problem is ,&lt;/p&gt;&lt;p&gt;when i enter any date with the date field less than 12, access is considering it as month, for example, 03/05/2009 (dd/mm/yyyy - 3rd may) is ending up as March 5th.&amp;nbsp;&lt;/p&gt;&lt;p&gt;when i enter a date with date field greater than 12, it is working properly.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I would like to know what is going wrong, and what can i do to solve this problem.&lt;/p&gt;&lt;p&gt;Thanks in advance.&lt;/p&gt;&lt;p&gt;Regards&lt;/p&gt;</description></item></channel></rss>