<?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: Inserting records into access database</title><link>http://forums.asp.net/thread/3269337.aspx</link><pubDate>Wed, 01 Jul 2009 16:00:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269337</guid><dc:creator>hans_v</dc:creator><author>hans_v</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269337.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3269337</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;amit.jain:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;than use olebd insted of SQL &lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So with OleDb you&amp;#39;re not required to use SQL??????&lt;/p&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;amit.jain:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;and use accessDataSource instead of SqlDataSOurce &lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;Quess what? The AccessDataSource control inherits the SqlDataSource class and replaces the ConnectionString property with a DataFile property to make it more convenient to connect to a Microsoft Access database&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/8e5545e1.aspx"&gt;http://msdn.microsoft.com/en-us/library/8e5545e1.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So everything the accessDatasource can do, the sqlDatasource control can do that also. The only difference is the connectionstring, I think it&amp;#39;s better to use the sqlDatasource so you can store the connectionsting in the web.config, and more important, when you&amp;#39;ve a password protected mdb you cannot use the accessDataSource anyway....&lt;/p&gt;</description></item><item><title>Re: Inserting records into access database</title><link>http://forums.asp.net/thread/3269293.aspx</link><pubDate>Wed, 01 Jul 2009 15:37:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269293</guid><dc:creator>amit.jain</dc:creator><author>amit.jain</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269293.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3269293</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;FrankEnem:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;pls I am using access database.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;than use olebd insted of SQL , and use accessDataSource instead of SqlDataSOurce &lt;/p&gt;
&lt;p&gt;refer link below &lt;/p&gt;
&lt;p&gt;http://forums.asp.net/p/1364640/2829655.aspx&lt;/p&gt;</description></item><item><title>Re: Inserting records into access database</title><link>http://forums.asp.net/thread/3269207.aspx</link><pubDate>Wed, 01 Jul 2009 14:56:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269207</guid><dc:creator>hans_v</dc:creator><author>hans_v</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269207.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3269207</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;adeelehsan:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Because USERS may be&amp;nbsp;a reserve word or&amp;nbsp;reserve name of an existing&amp;nbsp;object.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;No it is not (USER is). The complete list of Jet (in an ASP.NET environment we&amp;#39;re dealing with a Jet Database Engine) can be found &lt;a href="http://support.microsoft.com/kb/321266" target="_blank"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;papabear:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Basically you need to specify the parameters using the @&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;No, that&amp;#39;s not required. Jet will thread any unknown string as a parameter. Off course, it is a good habit using @&lt;/p&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;papabear:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;then refer to them on the InsertParameters section...&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;Be aware that when using OleDB, parameters are not recognized by their name, but by their position. So the parameters must be addes in the parametercollection in the same order they appear in the sql string. &lt;/p&gt;
&lt;p&gt;SqlDataSource1.InsertParameters.Add(&amp;quot;Paremeter1&amp;quot;, Me.Account.Text)&lt;br /&gt;SqlDataSource1.InsertParameters.Add(&amp;quot;Paremeter2 Or any other name, even an empty string will do&amp;quot;, Me.AccountName.Text)&lt;/p&gt;
&lt;p&gt;is OK&lt;/p&gt;
&lt;p&gt;SqlDataSource1.InsertParameters.Add(&amp;quot;@ACCOUNTNAME&amp;quot;, Me.AccountName.Text)&lt;br /&gt;SqlDataSource1.InsertParameters.Add(&amp;quot;@ACCOUNTID&amp;quot;, Me.Account.Text)&lt;br /&gt;&lt;br /&gt;is NOT OK&lt;/p&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;FrankEnem:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;SqlDataSource1.InsertCommand = &amp;quot;Insert INTO USERS (ACCOUNTID, ACCOUNTNAME)&amp;quot; &amp;amp; _&lt;br /&gt;&amp;nbsp; &amp;quot;Values(01011,Accounts Payable)&amp;quot;&lt;br /&gt;&amp;nbsp; SqlDataSource1.UpdateParameters.Clear()&lt;br /&gt;&amp;nbsp; SqlDataSource1.InsertParameters.Add(&amp;quot;ACCOUNTID&amp;quot;, Me.Account.Text)&lt;br /&gt;&amp;nbsp; SqlDataSource1.InsertParameters.Add(&amp;quot;ACCOUNTNAME&amp;quot;, Me.AccountName.Text)&lt;br /&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In this case the first &amp;#39;parameter&amp;#39; isn&amp;#39;t threaded as a parameter, because it is a numeric value. Furthurmore, parameters may not have spaces in them. If you have parameters (or field or tablenames) with spaces, or you&amp;#39;re using Reserved words, you should enclose them in brackets, like [Accounts Payable]. Change the code as papabear showed you and it should work&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Inserting records into access database</title><link>http://forums.asp.net/thread/3269023.aspx</link><pubDate>Wed, 01 Jul 2009 13:31:35 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269023</guid><dc:creator>adeelehsan</dc:creator><author>adeelehsan</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269023.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3269023</wfw:commentRss><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;Try using AccessDataSource instead of SqlDataSource. Also enclose the table name &amp;quot;USERS&amp;quot; in square braces like:&lt;/p&gt;
&lt;p&gt;insert into [USERS]........................&lt;/p&gt;
&lt;p&gt;Because USERS may be&amp;nbsp;a reserve word or&amp;nbsp;reserve name of an existing&amp;nbsp;object.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Inserting records into access database</title><link>http://forums.asp.net/thread/3269017.aspx</link><pubDate>Wed, 01 Jul 2009 13:30:48 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269017</guid><dc:creator>papabear</dc:creator><author>papabear</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269017.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3269017</wfw:commentRss><description>&lt;p&gt;Your insert statement should be more like this:&lt;/p&gt;&lt;p&gt;SqlDataSource1.InsertCommand=&amp;quot;Insert INTO USERS (ACCOUNTID, ACCOUNTNAME) &amp;quot; &amp;amp; _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot; VALUES(@AccountID, @AccountName)&amp;quot;&lt;br /&gt;SqlDataSource1.InsertParameters.Add(&amp;quot;@AccountId&amp;quot;, Me.Account.Text)&lt;br /&gt;SqlDataSource1.InsertParameters.Add(&amp;quot;@AccountName&amp;quot;, Me.AccountName.Text)&lt;/p&gt;&lt;p&gt;Basically you need to specify the parameters using the @ and then refer to them on the InsertParameters section...&lt;br /&gt;&lt;/p&gt;&lt;p&gt;See &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.insert%28VS.80%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.insert(VS.80).aspx&lt;/a&gt; for more...&lt;/p&gt;&lt;p&gt;hope this helps,&lt;/p&gt;&lt;p&gt;m&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Inserting records into access database</title><link>http://forums.asp.net/thread/3268909.aspx</link><pubDate>Wed, 01 Jul 2009 12:49:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3268909</guid><dc:creator>FrankEnem</dc:creator><author>FrankEnem</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3268909.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=55&amp;PostID=3268909</wfw:commentRss><description>&lt;p&gt; Please I have a web form with two textbox Account Id and Account Name. I have another button submit. I want to insert the values in the textbox in the access table when the submit button is click.&lt;/p&gt;&lt;p&gt;------------&lt;/p&gt;&lt;p&gt;I have created an sqldatasource; sqldatasource1 on the webform and written this code on the button_click&lt;/p&gt;&lt;p&gt;SqlDataSource1.InsertCommand = &amp;quot;Insert INTO USERS (ACCOUNTID, ACCOUNTNAME)&amp;quot; &amp;amp; _&lt;br /&gt;                                       &amp;quot;Values(01011,Accounts Payable)&amp;quot;&lt;br /&gt;        SqlDataSource1.UpdateParameters.Clear()&lt;br /&gt;        SqlDataSource1.InsertParameters.Add(&amp;quot;ACCOUNTID&amp;quot;, Me.Account.Text)&lt;br /&gt;        SqlDataSource1.InsertParameters.Add(&amp;quot;ACCOUNTNAME&amp;quot;, Me.AccountName.Text)&lt;br /&gt;  SqlDataSource1.Insert()&lt;/p&gt;&lt;p&gt;This gave me an error message &amp;quot; Syntax Error in INsert&amp;quot;&lt;/p&gt;&lt;p&gt;------------&lt;/p&gt;&lt;p&gt;If you are responding to this thread, pls bear in mind that I an new and started this just a few days ago. I will like everything to be very simple.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thanks &lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;</description></item></channel></rss>