Click here to Skip to main content
12,692,778 members (33,220 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Access database
Hi, my frustration levels are so high at the moment I could Yell, so please ignore any errors.

We have a legacy Access system that has forms and database initialization. The Access system is live and we are trying to port it across form by web form to C#. net.

We have not been able to migrate to SQL due to the large number of errors that occur during the MS migration.

The one great thing about Access is how easy it is to build forms, doing things in C# I have found illogical and frustrating.

At the moment this is what I am stuck on. We have a table that is very badly normallized. It is a table of orders to be delivered. If a client has a more than one order for a day the orderdate, preparation (or roast) date, required date and other fields are duplicated.

So I am keen to create a master detail form. I have created an object with header and details:

<blockquote class="FQ"><div class="FQA">Quote:</div>


I have then also created an object which I was hoping to link as an object datasource to the detailview (header / master) and gridview (lines / details)

<blockquote class="FQ"><div class="FQA">Quote:</div>


I had previously used
da.Fill(ds, "Orders");
but this seems to only return the data from the OrdersTbl not the customers table.

All I want to do is be able to create my own SELECT, UPDATE, INSERT and DELETE or CRED commands, and attach them to the grid / detail view. Is this really such a mission!


I have used many articles on CodeProject and ASP.NET to get this far and now I too frustrated. Is there not an easier way to do this?

I had tried to attach the class to the Object data source as below, but this is also problematic, since placing the class in the app_code folder seems to make to compiling not work and the auto fillful programming too.
<asp:ObjectDataSource ID="odsOrderHeader" runat="server" TypeName="TrackerDotNet.App_Code.OrdersData" 
    EnablePaging="true" SelectMethod="LoadOrderHeader" >
        <SelectParameters>
          <asp:QueryStringParameter DefaultValue="1" Name="CustomerId" QueryStringField="CustomerID" Type="Int32" />
          <asp:QueryStringParameter Name="RoastDate" QueryStringField="PrepDate" Type="DateTime" />
        </SelectParameters>

      </asp:ObjectDataSource>
Posted 25-Feb-13 9:53am
Updated 25-Feb-13 10:18am
v2
Comments
Andrew Cherednik 25-Feb-13 19:04pm
   
usually this works fine. I used Access very often. It has some limitations. Have you tried to run this query in access Query Wizard (when you switch to SQL Design View)? Does it show any errors?
Warren Machanik 26-Feb-13 9:54am
   
Thanks for the reply.

Query works fine, I normally "design" them in the SQL design view, that is a great feature wish it could create the data object.

I am getting errors attaching the object data source. Also in the class the CTRL+Space does not work properly so I have to check each command manually.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

After much renaming and recreating this is what I can tell those that have the same frustrations.

1. Firstly the public class that you are accessing for both the data class (in my case
public class OrderHeaderDetails
must be in the App_code folder, I have no idea why.
2. Also in the same folder must be the class that the object data source binds too, I am not sure why either, but when I put it in another folder I got name space errors
3. code in the app_code folder does not seem to have normal features if you compile / build it does not pick up compile / build errors like the rest of the code, instead only at run time do you get run time errors that you then need to fix (gee this reminds me of a language that I hate starts with "p" and ends in "hp"). I am not sure if there is a way around this.
4. Code auto complete (the thing that lets you easily access library routines and variable names) does not work in classes created under the strange an unexplained bermund triangle ish folder app_code

Once you follow these guide lines, and have the patience to fix error after error that may be cause by something as stupid as a misspelt function call to
OldDbDataReader 
for example. This code does work.

the best references for this type of coding I have found here: http://msdn.microsoft.com/en-us/library/ms178538(v=vs.100).aspx[^]

And

http://www.manuelabadia.com/blog/PermaLink,guid,c72852ae-1fdd-4934-a715-f565ceaf21cc.aspx[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100